#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 1e3 + 10;
int n, t, maxn = INF, ans, sum;
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (t = 1; t <= 100; t++) {
    sum = 0;
    for (int i = 0; i < n; i++)
      sum += min(abs(a[i] - t), min(abs(a[i] - t + 1), abs(a[i] - t - 1)));
    if (sum < maxn) {
      maxn = sum;
      ans = t;
    }
  }
  printf("%d %d", ans, maxn);
  return 0;
}
