fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); println!( "{}", match s.trim().parse::().unwrap() % 3 { 2 => 1, 1 => 2, _ => 0, } ); }