#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[1005], t = 99999, sum = 1000000, s;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= 100; i++) {
    s = 0;
    for (int j = 1; j <= n; j++) {
      s += min(min(abs(a[j] - i), abs(a[j] - i - 1)), abs(a[j] - i + 1));
    }
    if (s < sum) {
      sum = s;
      t = i;
    }
  }
  printf("%d %d", t, sum);
  return 0;
}
