#include <bits/stdc++.h>
using namespace std;
int judge(int a, int b) {
  if (a < 10 && b < 10) {
    if (a == 0 && b == 0) return 1;
    return 0;
  }
  if (a < 10 && b >= 10) {
    if (b % 10 == 0) {
      if (b / 10 == a) return 1;
    }
    return 0;
  }
  if (a >= 10 && b < 10) {
    if (a % 10 == 0) {
      if (a / 10 == b) return 1;
    }
    return 0;
  }
  if (a >= 10 && b >= 10) {
    if (a % 10 == b / 10 && a / 10 == b % 10) return 1;
    return 0;
  }
}
int main() {
  int a, b;
  char c;
  while (cin >> a >> c >> b) {
    int num = 0;
    while (judge(a, b) != 1) {
      num++;
      b++;
      if (b == 60) {
        b = 0;
        a++;
        if (a == 24) a = 0;
      }
    }
    cout << num << endl;
  }
}
