#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long int> t;
  long long int x;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    t.push_back(x);
  }
  sort(t.begin(), t.end());
  long long int tmin = t[0], tmax = t[n - 1];
  long long int cost = 0;
  long long int tt;
  long long int cc = 100 * 1000 + 1;
  for (long long int i = tmin; i <= tmax; i++) {
    for (int j = 0; j < n; ++j) {
      if (t[j] > i + 1) cost += abs(t[j] - (i + 1));
      if (t[j] < i - 1) cost += abs(t[j] - (i - 1));
    }
    if (cost < cc) {
      cc = cost;
      tt = i;
      cost = 0;
    }
  }
  cout << tt << " " << cc;
}
