#include <string.h>
#define MAXN 1400
char map[MAXN][MAXN+1];
struct tx{
int deep;
int bu;
};
struct tx T[MAXN][MAXN];
struct po{
short x,y;
};
struct po Que[80000];
int head,tail;
int N;
int deep0=0x70000000,bu0=0x70000000;
void add(int x0, int y0,int x, int y, int a)
{
int deep1,bu1;
if((x>=0)&&(x<N)&&(y>=0)&&(y<N)&&(map[x][y]!='*'))
{
deep1=T[x0][y0].deep+1;
bu1=T[x0][y0].bu+a;
if((!T[x][y].bu)||(deep1<T[x][y].deep)||( (deep1==T[x][y].deep) && (bu1<T[x][y].bu) ))
{
T[x][y].deep=T[x0][y0].deep+1;
T[x][y].bu=T[x0][y0].bu+a;
Que[tail].x=x;
Que[tail].y=y;
tail++;
if(tail==80000) tail=0;
}
}
}
int solve(int x, int y)
{
if(map[x][y]=='*') return 0;
memset(T,0,sizeof(T));
head=0; tail=1;
Que[0].x=x;
Que[0].y=y;
T[x][y].bu=1;
while(head!=tail)
{
x=Que[head].x;
y=Que[head].y;
if(T[N-1][N-1].deep&&(T[x][y].deep>=T[N-1][N-1].deep))
{
head++;
if(head==80000) head=0;
continue;
}
switch(map[x][y])
{
case 'A':
add(x,y,x-1,y,1);
add(x,y,x+1,y,1);
add(x,y,x,y-1,1);
add(x,y,x,y+1,1);
break;
case 'B':
add(x,y,x-2,y,1);
add(x,y,x+2,y,1);
add(x,y,x,y-2,1);
add(x,y,x,y+2,1);
break;
case 'C':
add(x,y,x-1,y-1,2);
add(x,y,x+1,y-1,2);
add(x,y,x+1,y-1,2);
add(x,y,x-1,y+1,2);
break;
}
head++;
if(head==80000) head=0;
}
if(T[N-1][N-1].bu)
{
if(T[N-1][N-1].deep<deep0)
{
deep0=T[N-1][N-1].deep;
bu0=T[N-1][N-1].bu;
}
else if((T[N-1][N-1].deep==deep0)&&(T[N-1][N-1].bu<bu0))
bu0=T[N-1][N-1].bu;
return 1;
}
return 0;
}
int main()
{
int ret,i,i1=1,i2=1;
scanf("%d",&N);
for(i=0;i<N;i++)
scanf("%s",map[i]);
solve(0,0);
solve(0,N-1);
solve(N-1,0);
if(deep0!=0x70000000)
printf("%d",bu0);
else
printf("No answer");
}