#include <bits/stdc++.h>
using namespace std;
long long n, A[100005];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> A[i];
  long long ans = 4444444444444444444, anst = 0;
  ;
  for (long long t = 1; t <= 100; t++) {
    long long ret = 0;
    for (long long i = 1; i <= n; i++)
      ret += min(abs(A[i] - t), min(abs(A[i] - (t - 1)), abs(A[i] - (t + 1))));
    if (ret < ans) ans = ret, anst = t;
  }
  cout << anst << " " << ans;
}
