#include using namespace std; const long long INF = 1000000000000000; int main(){ int N; cin >> N; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } int X = N / 2; vector P; for (int i = 0; i < N; i++){ if (A[i] <= X){ P.push_back(i); } } if (N % 2 == 1){ long long Y = 0; for (int i = 0; i < N / 2; i++){ Y += abs(P[i] - (i * 2 + 1)); } cout << X << ' ' << Y << endl; } else { vector L(N / 2 + 1); L[0] = 0; for (int i = 0; i < N / 2; i++){ L[i + 1] = L[i] + abs(P[i] - (i * 2 + 1)); } vector R(N / 2 + 1); R[N / 2] = 0; for (int i = N / 2 - 1; i >= 0; i--){ R[i] = R[i + 1] + abs(P[i] - i * 2); } //? cout << X << ' ' << min(L[N / 2], R[N / 2]) << endl; } }