#include <bits/stdc++.h>
using namespace std;
using L = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  L n, mini = 1000000, q = 0;
  cin >> n;
  L arr[n];
  for (L i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  for (L j = arr[0]; j <= arr[n - 1]; ++j) {
    L sum = 0;
    for (L k = 0; k < n; ++k) {
      if (arr[k] != j && arr[k] != j - 1 && arr[k] != j + 1) {
        if (arr[k] < j - 1) {
          sum = sum + j - 1 - arr[k];
        } else {
          sum = sum + arr[k] - j - 1;
        }
      }
    }
    if (sum < mini) {
      mini = sum;
      q = j;
    }
  }
  cout << q << " " << mini;
  return 0;
}
