Олимпиадный тренинг

Задача 33251. one horse


Задача

Темы: Обход в ширину
On the chessboard NxN in the cell (x1, y1) there is a hungry chess knight. He wants to get into the cell (x2, y2), where delicious chess grass grows. What is the least number of moves he has to make to do this?
 
Input: The program receives five numbers: N, x1< /code>, y1, x2, y2 (\(5 <= N <= 20\), \(1 <= x_1,\ y_1,\ x_2,\ y_2 <= N\)).
The top left cell of the board has coordinates (1, 1), the bottom right cell has coordinates (N, N).
 
Output: Print a single number K - the least necessary number of knight moves. 
 

 

Examples
# Input Output
1 5
1 1
3 2
1