#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, x, mx = -1, asdf, cost = 0, mn = 500;
  vector<int> v1;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> x;
    v1.push_back(x);
    if (x > mx) {
      mx = x;
    }
    if (mn > x) {
      mn = x;
    }
  }
  if (mx == mn || abs(mn - mx) == 1) {
    cout << mx << " " << 0 << "\n";
    return 0;
  } else if (mx - mn == 2) {
    cout << mn + 1 << " " << 0 << "\n";
    return 0;
  } else {
    sort(v1.begin(), v1.end());
    int min = 2e9;
    for (int i = mn; i <= mx; i++) {
      cost = 0;
      for (int j = 0; j < v1.size(); j++) {
        if (v1[j] < i) {
          cost += (i - 1) - v1[j];
        } else if (v1[j] == i) {
          continue;
        } else if (v1[j] > i) {
          cost += v1[j] - (i + 1);
        }
      }
      if (cost < min) {
        min = cost;
        asdf = i;
      }
    }
    cout << asdf << " " << min << endl;
  }
  return 0;
}
