Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 × 8 table. A field is represented by a pair of integers (*r*, *c*) — the number of the row and the number of the column (in a classical game the columns are traditionally indexed by letters). Each chess piece takes up exactly one field. To make a move is to move a chess piece, the pieces move by the following rules:
 -  A rook moves any number of fields horizontally or vertically. -  A bishop moves any number of fields diagonally. -  A king moves one field in any direction — horizontally, vertically or diagonally. 
Petya is thinking about the following problem: what minimum number of moves is needed for each of these pieces to move from field (*r*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">1</sub>) to field (*r*<sub class="lower-index">2</sub>, *c*<sub class="lower-index">2</sub>)? At that, we assume that there are no more pieces besides this one on the board. Help him solve this problem.
The input contains four integers *r*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">1</sub>, *r*<sub class="lower-index">2</sub>, *c*<sub class="lower-index">2</sub> (1 ≤ *r*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">1</sub>, *r*<sub class="lower-index">2</sub>, *c*<sub class="lower-index">2</sub> ≤ 8) — the coordinates of the starting and the final field. The starting field doesn't coincide with the final one.

You can assume that the chessboard rows are numbered from top to bottom 1 through 8, and the columns are numbered from left to right 1 through 8.
class Queue:  # Initialize a queue
    def __init__(self):
        self.head = []
        self.tail = []

    def queue(self, item):
        self.tail.append(item)

    def __len__(self):
        return len(self.head + self.tail)

    def dequeue(self):
        if not self.head:
            self.head = self.tail[::-1]
            self.tail = []
            return self.head.pop()
        else:
            return self.head.pop()


def backtrack(start, destination, seen):
    path = []
    node = destination
    while True:
        path.append(node)
        if node == start:
            break
        node = seen[node]
    return len(path) - 1


def breadth_first_search(graph, start, destination):
    seen = {start: None}
    node = start
    queue = Queue()
    queue.queue(start)
    while queue:
        node = queue.dequeue()
        for neighbour in graph[node]:
            if neighbour not in seen:
                queue.queue(neighbour)
                seen[neighbour] = node
    if destination not in seen:
        return 0
    return backtrack(start, destination, seen)


def rook_adjacency(r, c):
    adjacency = []
    for a in range(1, 9):
        if a != c:
            adjacency.append((r, a))
        if a != r:
            adjacency.append((a, c))
    return adjacency


def bishop_adjacency(r, c):
    adjacency = []
    i = 1
    while 1 <= r + i <= 8 and 1 <= c + i <= 8:
        adjacency.append((r + i, c + i))
        i += 1
    i = -1
    while 1 <= r + i <= 8 and 1 <= c + i <= 8:
        adjacency.append((r + i, c + i))
        i -= 1
    i = 1
    while 1 <= r + i <= 8 and 1 <= c - i <= 8:
        adjacency.append((r + i, c - i))
        i += 1
    i = -1
    while 1 <= r + i <= 8 and 1 <= c - i <= 8:
        adjacency.append((r + i, c - i))
        i -= 1
    return adjacency


def king_adjacency(r, c):
    adjacency = []
    list = [-1, 0, 1]
    for i in list:
        for j in list:
            if (i, j) != (0, 0) and 1 <= r + i <= 8 and 1 <= c + j <= 8:
                adjacency.append((r + i, c + j))
    return adjacency


def king_graph():
    adjacency = {}
    for r in range(1, 9):
        for c in range(1, 9):
            adjacency[(r, c)] = king_adjacency(r, c)
    return adjacency


def bishop_graph():
    adjacency = {}
    for r in range(1, 9):
        for c in range(1, 9):
            adjacency[(r, c)] = bishop_adjacency(r, c)
    return adjacency


def rook_graph():  # t = o(n^3) with bfs but it is possible in t = o(n) with case -partitioning
    adjacency = {}
    for r in range(1, 9):
        for c in range(1, 9):
            adjacency[(r, c)] = rook_adjacency(r, c)
    return adjacency


input_list = input().split()
start = (int(input_list[0]), int(input_list[1]))
destination = (int(input_list[2]), int(input_list[3]))
print(breadth_first_search(rook_graph(), start, destination))
print(breadth_first_search(bishop_graph(), start, destination))
print(breadth_first_search(king_graph(), start, destination))


