#include <bits/stdc++.h>
using namespace std;
bool comp(const pair<long long int, long long int>& a,
          const pair<long long int, long long int>& b) {
  return a.second > b.second;
};
long long int _ceil(long long int a, long long int b) {
  return (a + b - 1) / b;
}
int main() {
  long long int n, ans = 1e9, cost = 1e9, mn = 1e9, mx = 0, temp = 0;
  cin >> n;
  long long int a[n];
  for (int i = (0); i <= (n - 1); ++i)
    cin >> a[i], mx = max(a[i], mx), mn = min(mn, a[i]);
  for (int j = (mn); j <= (mx); ++j) {
    temp = 0;
    for (int i = (0); i <= (n - 1); ++i) {
      temp += abs(a[i] - j);
      if (temp > 0 && a[i] != j) --temp;
    }
    if (temp < cost) {
      cost = temp;
      ans = j;
    }
  }
  cout << ans << " " << cost << "\n";
}
