#include <bits/stdc++.h>
using namespace std;
const int maxn = 1100;
int n, a[maxn], ans, t;
void go(int lim) {
  int ret = 0;
  for (int i = 1; i <= n; i++)
    ret +=
        min(abs(a[i] - lim), min(abs(a[i] - (lim + 1)), abs(a[i] - (lim - 1))));
  if (ret < ans) ans = ret, t = lim;
}
int main() {
  scanf("%d", &n);
  ans = INT_MAX;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= 100; i++) go(i);
  printf("%d %d\n", t, ans);
  return 0;
}
