// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 10e-7
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
// mylittlepony
using namespace std;
int main() {
cin.sync_with_stdio(0);
int N;
cin >> N;
N =2*N+1;
vector< vector<int> > val(N,vector<int>(N));
for(int i =0; i < N; i++) for(int j =0; j < N; j++) cin >> val[i][j];
queue< pair<int,int> > q;
q.push(make_pair((N/2)*5+4,N/2));
int dx[] ={0,0,1,-1};
int dy[] ={1,-1,0,0};
vector< vector<int> > D[5];
for(int i =0; i < 5; i++) D[i].resize(N,vector<int>(N,N*N+tisic));
D[4][N/2][N/2] =0;
while(!q.empty()) {
pair<int,int> p =q.front();
int x =p.ff/5, y =p.ss, t =p.ff%5;
int d =(t == 4)?OVER9000:(val[x-dx[t]][y-dy[t]]-val[x][y]);
for(int k =0; k < 4; k++) if(min(x+dx[k],y+dy[k]) >= 0 && max(x+dx[k],y+dy[k]) < N) {
if(d >= val[x][y]-val[x+dx[k]][y+dy[k]] && val[x][y]-val[x+dx[k]][y+dy[k]] >= 0 && D[k][x+dx[k]][y+dy[k]] > D[t][x][y]+1) {
D[k][x+dx[k]][y+dy[k]] =D[t][x][y]+1;
q.push(make_pair(5*(x+dx[k])+k,y+dy[k]));}
}
q.pop();}
int d =N*N+tisic;
for(int i =0; i < N; i++) for(int j =0; j < N; j++) for(int k =0; k < 5; k++)
if(i == 0 || j == 0 || i == N-1 || j == N-1) d =min(d,D[k][i][j]);
if(d > N*N) {cout << "IMPOSSIBLE\n"; return 0;}
cout << d << "\n";
for(int i =0; i < N; i++) for(int j =0; j < N; j++) for(int k =0; k < 5; k++)
if(i == 0 || j == 0 || i ==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yKGludCBrID0wOyBrIDwgNTsgaysrKQogICAgCWlmKGkgPT0gMCB8fCBqID09IDAgfHwgaSA9PSBOLTEgfHwgaiA9PSBOLTEpIGQgPW1pbihkLERba11baV1bal0pOwogICAgaWYoZCA+IE4qTikge2NvdXQgPDwgIklNUE9TU0lCTEVcbiI7IHJldHVybiAwO30KCWNvdXQgPDwgZCA8PCAiXG4iOwogICAgZm9yKGludCBpID0wOyBpIDwgTjsgaSsrKSBmb3IoaW50IGogPTA7IGogPCBOOyBqKyspIGZvcihpbnQgayA9MDsgayA8IDU7IGsrKykgCiAgICAJaWYoaSA9PSAwIHx8IGogPT0gMCB8fCBpID09IE4tMSB8fCBqID09IE4tMSkgaWYoRFtrXVtpXVtqXSA9PSBkKSB7CiAgICAJCWNvdXQgPDwgaSsxIDw8ICIgIiA8PCBqKzEgPDwgIlxuIjsKICAgIAkJcmV0dXJuIDA7fQogICAJcmV0dXJuIDA7fQogICAgICAgIAovLyBsb29rIGF0IG15IGNvZGUKLy8gbXkgY29kZSBpcyBhbWF6aW5n