//#include
#include
int min=101;
int index[101];
int save[101];
int can_set(int chess[][100],int n){
int i,j;
for(i=0;i
for(j=0;j
if(chess[i][j]==0){
return 1;
}
}
}
return 0;
}
int can_put(int chess[][100],int n,int x,int y){
int i,j;
if(chess[x][y]==1){
return 0;
}
for(i=x-1,j=y-1;i>=0&&j>=0;i--,j--){
if(chess[i][j]==1){
return 0;
}
}
for(i=x-1;i>=0;i--){
if(chess[i][y]==1){
return 0;
}
}
for(i=x-1,j=y+1;i>=0&&y
if(chess[i][j]==1){
return 0;
}
}
for(j=y-1;j>=0;j--){
if(chess[x][j]==1){
return 0;
}
}
for(j=y+1;j
if(chess[x][j]==1){
return 0;
}
}
for(i=x+1,j=y-1;i=0;i++,j--){
if(chess[i][j]==1){
return 0;
}
}
for(i=x+1;i
if(chess[i][y]==1){
return 0;
}
}
for(i=x+1,j=y+1;i
if(chess[i][j]==1){
return 0;
}
}
return 1;
}
void put(int chess[][100],int n,int x,int y){
int i,j;
chess[x][y]==1;
for(i=x-1,j=y-1;i>=0&&j>=0;i--,j--)
chess[i][j]==1;
for(i=x-1;i>=0;i--)
chess[i][y]=1;
for(i=x-1,j=y+1;i>=0&&y
chess[i][j]==1;
for(j=y-1;j>=0;j--)
chess[x][j]=1;
for(j=y+1;j
chess[x][j]==1;
for(i=x+1,j=y-1;i=0;i++,j--)
chess[i][j]==1;
for(i=x+1;i
chess[i][y]==1;
for(i=x+1,j=y+1;i
chess[i][j]==1;
}
void receive(int chess[][100],int n,int x,int y){
int i,j;
chess[x][y]==0;
for(i=x-1,j=y-1;i>=0&&j>=0;i--,j--)
chess[i][j]==0;
for(i=x-1;i>=0;i--)
chess[i][y]=0;
for(i=x-1,j=y+1;i>=0&&y
chess[i][j]==0;
for(j=y-1;j>=0;j--)
chess[x][j]=0;
for(j=y+1;j
chess[x][j]==0;
for(i=x+1,j=y-1;i=0;i++,j--)
chess[i][j]==0;
for(i=x+1;i<n;i++)
chess[i][y]==0;
for(i=x+1,j=y+1;i<n&&j<n;i++,j++)
chess[i][j]==0;
}
void dfs(int chess[][100],int n,int step,int column){
int i;
if(!can_set(chess,n)){
printf("***");
if(step<min){
min=step;
memset(save,0,sizeof(int));
for(i=0;i<min;i++){
save[i]=index[i];
}
memset(index,0,sizeof(int));
step=0;
return;
}
}else{
for(i=0;i<n;i++){
if(can_put(chess,n,i,column)){
put(chess,n,i,column);
index[step]=column;
dfs(chess,n,step+1,column+1);
receive(chess,n,i,column);
index[step]=0;
}
}
if(i==n){
dfs(chess,n,step,column+1);
}
}
}
int main(){
int n,i,step,j;
int chess[100][100];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
chess[i][j]=0;
}
}
dfs(chess,n,step,0);
printf("%d\n",min);
memset(index,0,sizeof(int));
for(i=0;i<min;i++){
index[save[i]]=1;
}
for(i=0;i<n;i++){
if(index[i]==1){
printf("%d ",i);
}
}
return 0;
}