#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  while (cin >> n) {
    long long arr[n], t2 = 0, ans = 0, c = 1e9, tt;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      t2 = max(t2, arr[i]);
    }
    for (long long t = 1; t <= t2 + 1; t++) {
      ans = 0;
      for (long long i = 0; i < n; i++) {
        if (arr[i] < t - 1) {
          ans += t - 1 - arr[i];
        } else if (arr[i] > t + 1) {
          ans += arr[i] - t - 1;
        }
      }
      if (ans < c) {
        c = ans;
        tt = t;
      }
    }
    cout << tt << " " << c << endl;
  }
}
