fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); println!("{}", (8 - n.matches('0').count() as i64).abs()); }