#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, cost = 0, r, min = 100000000;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 1; i <= a[n - 1]; i++) {
    t = i;
    for (int j = 0; j < n; j++) {
      if (a[j] - t > 1) {
        cost = cost + a[j] - (t + 1);
      } else if (t - a[j] > 1) {
        cost = cost + t - 1 - a[j];
      }
    }
    if (cost < min) {
      min = cost;
      r = t;
    }
    cost = 0;
  }
  cout << r << " " << min;
}
