#include <stdio.h>
int main () {
int mins;
while(scanf("%d", &mins) != EOF) {
printf("%d\n", (60 - (mins + 35) % 60) % 60);
}
return 0;