#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<long> A;
  long N, L, R, M, T, Sum, Min = 2147483647;
  cin >> N;
  A.resize(N);
  for (long i = 0; i < N; ++i) cin >> A[i];
  for (long M = 1; M <= 100; ++M) {
    Sum = 0;
    for (long i = 0; i < N; ++i)
      Sum += min(min(abs(A[i] - M + 1), abs(A[i] - M - 1)), abs(A[i] - M));
    if (Sum < Min) {
      Min = Sum;
      T = M;
    }
  }
  cout << T << ' ' << Min;
  return 0;
}
