A, B, C, D = gets.split.map(&:to_i) x = C - A y = D - B if x == 0 or y == 0 or [x.abs, y.abs].max <= 2 and not (x.abs == 2 and y.abs == 2) puts 1 else puts 2 end