#include constexpr int T = 60 * 60 * 12; void solve() { int a, b; std::cin >> a >> b; int t = a * 3600 + b * 60; int h = t % T, m = t * 12 % T; if (m > h) m -= T; int ans = 0; while (m <= h) { m += 12; h += 1; ++ans; } std::cout << ans - 1 << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }