#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int a[maxn];
void fal() { cout << "NO\n"; }
void tr() { cout << "YES\n"; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cost = INT_MAX, t;
  for (int i = 1; i <= 111; i++) {
    int ans = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] > i) {
        ans += abs(a[j] - (i + 1));
      }
      if (a[j] < i) {
        ans += abs(a[j] - (i - 1));
      }
    }
    if (cost > ans) {
      cost = ans;
      t = i;
    }
  }
  cout << t << " " << cost;
  return 0;
}
