#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int i, t, ans = 1000000004;
  for (int j = 1; j <= 1000; j++) {
    int tt = 0;
    for (i = 0; i < n; i++) {
      if (arr[i] != j) tt += min(abs(j - arr[i] - 1), (abs(j - arr[i] + 1)));
    }
    if (tt < ans) {
      ans = tt;
      t = j;
    }
  }
  cout << t << ' ' << ans;
}
