#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  int minn = INT_MAX;
  int minn1 = INT_MAX;
  for (int i = 1; i <= 101; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] > i) b[j] = i + 1;
      if (a[j] < i) b[j] = i - 1;
      sum += abs(a[j] - b[j]);
    }
    if (sum < minn1) {
      minn1 = sum;
      minn = i;
    }
  }
  cout << minn << " " << minn1;
}
