#include <stdio.h>

inline swap(long &a, long &b) {
	a^=b^=a^=b;
}


int main() {
	FILE	*FI, *FO;
	FI=fopen("heapsort.in","rt");
	FO=fopen("heapsort.out","wt");
	long	n, i, k;
	long	a[60000];
	fscanf(FI,"%ld",&n);
	for (i=0; i<n-1; i++) {
		a[0]=i;
		a[i]=0;
		k=i;
		while (k) {
			swap(a[k],a[(k+1)/2-1]);
			k=(k+1)/2-1;
		}
	}
	fprintf(FO,"%d",n);
	for (i=1; i<n-1; i++) fprintf(FO," %d",a[i]+1);
	if (n!=1) fprintf(FO," 1\n",n);

	
		

	fclose(FI);
	fclose(FO);
	return 0;
}
