#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, *a, cost, minc = INT_MAX, t;
  float sum = 0;
  cin >> n;
  a = new int[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++) {
    cost = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] < i)
        cost += i - 1 - a[j];
      else if (a[j] > i)
        cost += a[j] - i - 1;
    }
    if (cost < minc) {
      minc = cost;
      t = i;
    }
  }
  cout << t << " " << minc;
  return 0;
}
