#include <bits/stdc++.h>
using namespace std;
int n;
int a[1009], mint, c, minc = INT_MAX;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int t = 1; t <= 100; t++) {
    c = 0;
    for (int i = 0; i < n; i++) {
      c += min(abs(a[i] - t), min(abs(a[i] - t - 1), abs(a[i] - t + 1)));
    }
    if (c < minc) {
      mint = t;
      minc = c;
    }
  }
  printf("%d %d\n", mint, minc);
}
