#include <iostream>
using namespace std;
int main(){
int m;
while (cin >> m){
cout << (60-m+25)%60 <<endl;
}