#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int first = 0, f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9';) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  for (; ch >= '0' && ch <= '9';) {
    first = first * 10 + ch - '0';
    ch = getchar();
  }
  return first * f;
}
int a[1010];
int p[1010];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  int ans = INT_MAX;
  for (int j = 0; j <= 101; j++) {
    int tmp = 0;
    for (int i = 1; i <= n; i++)
      if (a[i] > j)
        tmp += (a[i] - (j + 1));
      else if (a[i] < j)
        tmp += (j - 1 - a[i]);
    if (tmp < ans) {
      ans = tmp;
      p[0] = 0;
      p[1] = j;
    } else if (tmp == ans)
      p[++p[0]] = j;
  }
  printf("%d %d\n", p[1], ans);
}
