#include <iostream>
#include <vector>	
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#define pii pair<int,int>
#define ll long long
using namespace std;
vector<int> solve(vector<int>A) {
	int n = A.size();
	ll sm = n * (n + 1) / 2;
	ll cur = 0;
	ll j = n;
	vector<int>ans;
	if (A.size() == 1) {
		ans.push_back(1);
		return ans;
	}
	for (int i = n; cur < sm / 2; i--) {
		cur += i;
		j = i;
		if (cur < sm / 2) {
			ans.push_back(i - 1);
		}
	}
	cur -= j;
	int k = (sm / 2) - cur + (sm % 2 != 0);
	if (k != 0) {
		ans.push_back(k - 1);
	}

	for (int i = 0; i < j; i++) {
		if (i != k - 1) {
			ans.push_back(i);
		}
	}
	return ans;
}
/*int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int>ans = solve(a);
	for (auto i : ans) {
		cout << i << " ";
	}
}
*/