#include <stdio.h>
#include <stdlib.h>

int N;
int *a;

void FileRead()
{
	FILE *input = fopen("heapsort.in", "r");
	fscanf(input, "%d", &N);
	a = (int*) malloc((N+1)*sizeof(int));
	fclose(input);
}

/*void Debug()
{
	int i;
	FILE *debug = fopen("debug.txt", "a+");

	fclose(debug);
}*/

void Solution()
{
	int i, S, temp;

	a[1] = 1;
	for(i=2; i<=N; i++)
	{
		S = i-1;
		while( S != 1 )
		{
			temp = a[S];
			a[S] = a[S/2];
			a[S/2] = temp;
			S /= 2;
		}
		a[1] = i;
		a[i] = 1;
	}

}

void FileWrite()
{
	int i;
	FILE *output = fopen("heapsort.out", "w");
	for(i=1; i<N+1; i++)
		fprintf(output, "%d ", a[i]);
	fclose(output);
}

int main()
{
	FileRead();
	Solution();
	FileWrite();
	return 0;
}