#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int arr[N];
int main(void) {
  int n, ans = 0x3f3f3f3f, pos = -1;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= 100; i++) {
    int sum = 0;
    for (int j = 1; j <= n; j++)
      if (abs(arr[j] - i) > 1)
        sum += min(abs(arr[j] - (i + 1)), abs(arr[j] - (i - 1)));
    if (ans > sum) {
      pos = i;
      ans = sum;
    }
  }
  cout << pos << " " << ans << endl;
  return 0;
}
