#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int N;
  vector<int> V;
  cin >> N;
  int X;
  for (int i = 0; i < N; i++) {
    cin >> X;
    V.push_back(X);
  }
  int ans = 100100, t = 0;
  for (int i = 1; i <= 100; i++) {
    int cost = 0;
    for (int j = 0; j < N; j++) {
      if (abs(V[j] - i) > 1) {
        cost += min(abs(V[j] - (i + 1)), abs(V[j] - (i - 1)));
      }
    }
    if (cost < ans) {
      ans = cost;
      t = i;
    }
  }
  cout << t << ' ' << ans << endl;
  return 0;
}
