grid = gets.split(" ").map{|i| i.to_i} puts (grid[0] == grid[2] || grid[1] == grid[3] || (grid[0]-grid[2]).abs + (grid[1]-grid[3]).abs <= 3) ? 1 : 2