#include #include #include #include #include #include #include void printShortestPath(int n, int ii, int ji, int ij, int jj) { int k,l,f=1; k=ij-ii; l=jj-ji; if(k%2==0) { if(k%4==0) { if(l%2!=0) { printf("Impossible"); f=0; } } else if(l%2==0) { printf("Impossible"); f=0; } }//possible or not else { printf("Impossible"); f=0; }//possible or not if(f==1) { if(k<0) k=-1*k; if(l<0) l=-1*l; if((k+l)%3==0) printf("%d\n",(k+l)/3); else printf("%d\n",((k+l)/3)+1); }//min no. of moves } int main() { int n; scanf("%i", &n); int i_start; int j_start; int i_end; int j_end; scanf("%i %i %i %i", &i_start, &j_start, &i_end, &j_end); printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }