#include <bits/stdc++.h>
using namespace std;
int n;
int a[1005];
int sum = 0;
int cal(int k) {
  int res = 0;
  for (int i = 0; i < n; i++) {
    if (abs(a[i] - k) > 1) {
      res += (abs(a[i] - k) - 1);
    }
  }
  return res;
}
int main() {
  int minn = 99999999;
  int maxx = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
    minn = a[i] < minn ? a[i] : minn;
    maxx = a[i] > maxx ? a[i] : maxx;
  }
  int r1 = 1;
  int cost = 99999999;
  int now = 0;
  for (int i = minn; i <= maxx; i++) {
    now = cal(i);
    if (now < cost) {
      r1 = i;
      cost = now;
    }
  }
  printf("%d %d\n", r1, cost);
  return 0;
}
