#!/bin/python import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. global arr if (i_start == j_start) and (i_end == j_end): return 0 elif (abs(i_start-j_start)==abs(i_end-j_end) == 1): return "Impossible" elif i_start >= n or j_start >= n or i_end >= n or j_end >= n: return "Impossible" away = abs(i_start-j_start) + abs(i_end-j_end) if __name__ == "__main__": arr = [] n = int(raw_input().strip()) i_start, j_start, i_end, j_end = raw_input().strip().split(' ') i_start, j_start, i_end, j_end = [int(i_start), int(j_start), int(i_end), int(j_end)] printShortestPath(n, i_start, j_start, i_end, j_end)