import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int count = 0; static int pSPUtil(int[][] grid, int i_start, int j_start, int i_end, int j_end) { if(i_start < 0 || i_start >= grid.length || j_start < 0 || j_start >= grid.length || grid[i_start][j_start] == 1){ //System.out.println("co = " + i_start + " " + j_start); return 0; } grid[i_start][j_start] = 1; if(i_start == i_end && j_start == j_end) { //System.out.println("aya"); //count += 1; return 1; } return pSPUtil(grid, i_start - 2, j_start - 1, i_end, j_end) + pSPUtil(grid, i_start - 2, j_start + 1, i_end, j_end) + pSPUtil(grid, i_start, j_start + 2, i_end, j_end) + pSPUtil(grid, i_start + 2, j_start + 1, i_end, j_end) + pSPUtil(grid, i_start + 2, j_start - 1, i_end, j_end) + pSPUtil(grid, i_start, j_start - 2, i_end, j_end); } static void pSP(int n, int i_start, int j_start, int i_end, int j_end) { int[][] grid = new int[n][n]; for(int rows[] : grid) Arrays.fill(rows, 0); int res = pSPUtil(grid, i_start, j_start, i_end, j_end); if(res == 0)System.out.print("Impossible"); else { System.out.print(count); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i_start = in.nextInt(); int j_start = in.nextInt(); int i_end = in.nextInt(); int j_end = in.nextInt(); pSP(n, i_start, j_start, i_end, j_end); in.close(); } }