#include <bits/stdc++.h>
using namespace std;
int a[1005];
int b[1005];
int main(void) {
  int n, sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int minn = 1000000000, minx = 0;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= 100; i++) {
    sum = 0;
    for (int j = 1; j <= n; j++)
      if (abs(a[j] - i) > 1)
        sum += min(abs(a[j] - i), min(abs(a[j] - 1 - i), abs(a[j] + 1 - i)));
    if (sum < minn) {
      minn = sum;
      minx = i;
    }
  }
  cout << minx << " " << minn;
  return 0;
}
