#include <bits/stdc++.h>
using namespace std;
int a[1001], sum, minSum = 1000000000, minT, t, n, maxElement;
int main() {
  if (0) {
    freopen("CP.inp", "r", stdin);
    freopen("CP.out", "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    maxElement = max(maxElement, a[i]);
  }
  for (int t = 1; t <= maxElement; ++t) {
    sum = 0;
    for (int i = 1; i <= n; ++i) {
      if (a[i] != t)
        sum += abs(a[i] - t) - 1;
      else
        sum += abs(a[i] - t);
    }
    if (sum < minSum) minSum = sum, minT = t;
  }
  cout << minT << ' ' << minSum;
  return 0;
}
