#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
void debn(vector<int> a) {
  for (auto v : a) cout << v << ' ';
  cout << endl;
}
void debnn(vector<vector<int>> a) {
  for (auto v : a) {
    for (auto w : v) cout << w << ' ';
    cout << endl;
  }
}
long long powmod(long long x, long long y, long long mod) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 1e9;
  int q = 0;
  for (int x = 1; x < 101; x++) {
    int t = 0;
    for (int i = 0; i < n; i++) {
      t += min(abs(x - a[i]), min(abs(x + 1 - a[i]), abs(x - 1 - a[i])));
    }
    if (t < ans) ans = t, q = x;
  }
  cout << q << ' ' << ans << endl;
  return 0;
}
