use std::io::*; use std::str::FromStr; fn calc(a: i32, b: i32) -> i32 { let a = if a >= 12 { a - 12 } else { a }; if a == 0 && b == 0 { return 0; } let mut x = (a * 60 + b) * 60; let mut y = 720 * b; let mut ret = 0; loop { if y < x && y + 12 == x + 1 { ret += 1; break; } else if y < x && y + 12 >= x + 1 { break; } x += 1; y += 12; ret += 1; if x >= 360 * 120 { x -= 360 * 120; } if y >= 360 * 120 { y -= 360 * 120; } } ret } fn main() { let mut s = String::new(); stdin().read_line(&mut s).ok(); let mut itr = s.split_whitespace().map(|x| i32::from_str(x).unwrap()); let (a, b) = (itr.next().unwrap(), itr.next().unwrap()); println!("{}", calc(a, b)); }