#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
using namespace std;
int n, a[1004];
void solve(int ks) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int ans = 1000000000;
  int val = -1;
  for (int i = 1; i <= 101; i++) {
    int cost = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] < i - 1)
        cost += i - 1 - a[j];
      else if (a[j] > i + 1)
        cost += a[j] - i - 1;
    }
    if (cost < ans) {
      ans = ((ans) < (cost) ? (ans) : (cost));
      val = i;
    }
  }
  printf("%d %d\n", val, ans);
}
int main() {
  if (0) {
    int T;
    scanf("%d", &T);
    for (int ks = 1; ks <= T; ks++) solve(ks);
  } else {
    solve(0);
  }
  return 0;
}
