#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, t, cost = 1e9;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = a[0]; i <= a[n - 1]; i++) {
    int temp = 0;
    for (int j = 0; j < n; j++) {
      temp += max(0, abs(a[j] - i) - 1);
    }
    if (temp < cost) {
      cost = temp;
      t = i;
    }
  }
  cout << t << " " << cost;
  return 0;
}
