a, b = map(int, input().split()) s = 60 * 60 * a + 60 * b t = 12 * 60 * b r = (s - t) % (12 * 60 * 60) ans = r // 11 print(ans)