#include <bits/stdc++.h>
using namespace std;
int main() {
  long long r, S, Z, s1, s2, s3, s4, s5, s6, s7, s8, x, y, z, n, m, i, j, l, k,
      t;
  long long a[100001];
  long long b[200001];
  long long c[100001];
  long long d[100001];
  string q1;
  string q2;
  string q3;
  string s;
  string sq[3001];
  map<long long, long long> g;
  map<long long, long long>::iterator it;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  if (1 >= a[n] - a[1]) {
    cout << a[1] << " " << 0;
    exit(0);
  }
  k = 99999999;
  x = 0;
  for (i = a[1] + 1; i < a[n]; i++) {
    x = 0;
    for (j = 1; j <= n; j++) {
      t = i - a[j];
      if (t < 0) t = t * (-1);
      if (t > 1) x = x + t - 1;
    }
    k = min(k, x);
    if (k == x) r = i;
  }
  cout << r << " " << k;
}
