#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int a[maxn];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n, t, ans, sum;
  cin >> n;
  ans = 1000000;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= 100; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++)
      sum += min(abs(a[j] - i), min(abs(a[j] - 1 - i), abs(a[j] + 1 - i)));
    if (sum < ans) {
      ans = sum;
      t = i;
    }
  }
  cout << t << " " << ans;
  return 0;
}
