#include
using namespace std;
const int maxn 50;
int n,tot,pos[maxn];
int vis[3][maxn];
void dfs(int cur)
{
if(cur= =n)
{
for(int i=0;i<n;i++)
{
for(int j=0,j<n;j++)
{
if(pos[i]= =j) cout<<‘x’;
else cout<<‘o’;
if(j= =n-1) cout<<ends;
}
}
cout<<endl;
tot++;
}else
{
for(int i=0;i<n;i++)
{
if(!vis[0][i]&&!vis[1][cur+i]&&!vis[2][cur-i+n])
{
pos[cur]=i;
vis[0][i]=1;
vis[1][cur+i]=1;
vis[2][cur-i+n]=1;
dfs(cur+1);
vis[0][i]=0;
vis[1][cur+i]=0;
vis[2][cur-i+n]=0;
}
}
}
}
int main()
{
void dfs(int cur);
cin>>n;
dfs(0);
cout<<tot;
return 0;
}