#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;

ifstream fin("heapsort.in");
ofstream fout("heapsort.out");

int a[100000];
int n;

void swap (int i, int j) {
	int tmp = a[i];
	a[i] = a[j];
	a[j] = tmp;
}

void unsort (int free) {
	int cur = 1;
	//int val = a[cur];
	//a[cur] = a[free];
	int last = a[cur];
	//swap (cur, free);
	a[cur] = a[free];
	while (2*cur < free) {
		//swap (cur, 2*cur);
		//last = a[cur*2];
		int tmp = a[cur*2];
		a[cur*2] = last;
		last = tmp;
		cur*=2;
	}
	//a[free] = val;
	//swap (free, cur);
	a[free] = last;
	int tipp = free;
	while (tipp > 1) {
		if (a[tipp/2] < a[tipp]) {
			swap (tipp/2, tipp);
		} else break;
		tipp /= 2;
	}
}

void output () {
	for (int i=1; i<=n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;

}

int main () {
	fin >> n;
	int i;
	for (i=1; i<=n; i++)
		a[i] = i;
	for (i=2; i<=n; i++) {
		unsort (i);
		//output ();
	}
	for (i=1; i<=n; i++) {
		fout << a[i] << " ";
	}
	fout << endl;
	return 0;
}