#include <bits/stdc++.h>
using namespace std;
struct fastIO {
  fastIO() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
  }
} fio;
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
void test_case() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < v.size(); i++) cin >> v[i];
  ;
  long long ans = 1e9, c = 0;
  for (long long num = 1; num < 101; num++) {
    long long val = 0;
    for (long long i = 0; i < n; i++) {
      val += min(abs(v[i] - num),
                 min(abs(v[i] - (num - 1)), abs(v[i] - (num + 1))));
    }
    if (ans > val) {
      ans = val;
      c = num;
    }
  }
  cout << c << " " << ans << "\n";
}
int32_t main() {
  long long T = 1;
  while (T--) {
    test_case();
  }
  return 0;
}
