#include "partition.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <deque>
#include <math.h>
#include <array>
#include <string>

#define rep(i, s, e) for (ll i = s; i < e; i++)
#define upmax(a, b) a = max(a, b)
#define upmin(a, b) a = min(a, b)

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;

const ll INF = 1e18;

vector<int> solve(vector<int> A) {
    ll n = A.size();
    vpll arr(n);
    rep(i, 0, n) {
        arr[i] = { A[i], i };
    }
    sort(arr.begin(), arr.end());
    if (n == 1) return vector<int>({ 0 });
    vector<int> ans(n);
    rep(i, 0, n) ans[i] = i;
    swap(ans[n / 2 - 1], ans[n - 1]);
    return ans;
}
