#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge {
  ll from;
  ll to;
  ll cost;
};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll ans = -1;
  ll cost = -1;
  for (int t = 1; t <= 10000; t++) {
    ll temp = 0;
    for (int i = 0; i < n; ++i) {
      if (t == 1) {
        temp += min(abs(a[i] - t), abs(a[i] - t - 1));
      } else {
        temp += min(abs(a[i] - t + 1), min(abs(a[i] - t - 1), abs(a[i] - t)));
      }
    }
    if (ans == -1 || cost > temp) {
      ans = t;
      cost = temp;
    }
  }
  cout << ans << " " << cost << endl;
  return 0;
}
