x, y = gets.split.map(&:to_i) if x == 0 && y == 0 puts 0 exit end if x.abs == y.abs puts 1 exit end puts x == 0 || y == 0 ? 1 : 2