#include<stdio.h>
int main()
{ int i, n=100,k=0,j=0,a[1000]={0};//k:数数123的变量,j记录离开队列人数的变量scanf("%d",&n);for(int ii=0; ii<n; ii++){ for( i=0; i<n; i++){// printf("wei=%d ",i);if((a[i]==0)&&(k<=2)){ k++;// printf("i=%d ",i);}if((k==3)&&(a[i]==0)) {a[i]=1;k=0;j++;printf("%d ",i);}if(j==n){printf("\n%d",i+1);return 0;}}}return 0;
}