#include <bits/stdc++.h>
using namespace std;
int num[1100];
int main() {
  int n, i, c, sum = 0, j, k;
  int ans = 1000000;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> num[i];
  sort(num + 1, num + 1 + n);
  for (i = 1; i <= 100; i++) {
    sum = 0;
    for (j = 1; j <= n; j++) {
      if (num[j] < i - 1) sum = sum + i - 1 - num[j];
      if (num[j] > i + 1) sum = sum + num[j] - i - 1;
    }
    if (ans > sum) {
      k = i;
      ans = sum;
    }
  }
  cout << k << " " << ans << endl;
  return 0;
}
