#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const int N = 1e3 + 5;
const int INF = 1e9 + 5;
int n, a[N];
int Chk(int t) {
  int ret = 0, mi;
  for (int i = 0; i < n; i++) {
    mi = min(abs(a[i] - t), abs(a[i] - t - 1));
    mi = min(mi, abs(a[i] - t + 1));
    ret += mi;
  }
  return ret;
}
void another() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int nt = -1, nc = 1 << 30;
  for (int i = 1; i <= 100; i++) {
    int tmp = Chk(i);
    if (tmp < nc) nt = i, nc = tmp;
  }
  cout << nt << " " << nc;
}
int main() { another(); }
