#include "rotate.h"
#include <bits/stdc++.h>
#define pii pair <int, int>
#define tiii tuple <int, int, int>
#define emb emplace_back
#define all(a) a.begin(), a.end()
using namespace std;
const int N = 2e5 + 5;
// const int inf = 1e18;
void energy(int n, std::vector<int> v){
vector <pii> vv;
for (int i = 0; i < n; i++) vv.emb(v[i], i);
sort(all(vv));
int l = 0, r = n - 1;
while (l <= r) {
rotate({vv[l].second}, 50000 - vv[l].first);
if (l == r) break;
rotate({vv[r].second}, 25000 - vv[r].first);
l++, r--;
}
}
/*
25000*n*n/4 = 6250n^2
what if we distribute?
*/