#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, t, maxx, minn, sum, ans = 99999, s[1001] = {0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &s[i]);
  sort(s, s + n);
  minn = s[0];
  maxx = s[n - 1];
  for (i = minn; i <= maxx; i++) {
    sum = 0;
    for (j = 0; j < n; j++) {
      if (max(s[j], i) - min(s[j], i) != 0)
        sum += max(s[j], i) - min(s[j], i) - 1;
    }
    if (sum < ans) t = i, ans = sum;
  }
  printf("%d %d\n", t, ans);
  return 0;
}
