#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  vector<int> arr;
  int cur;
  for (int i = 0; i < n; i++) {
    cin >> cur;
    arr.push_back(cur);
  }
  int min_cost = INT_MAX;
  int ans_t = 0;
  for (int t = 1; t <= 100; t++) {
    int cost = 0;
    for (int j = 0; j < n; j++) {
      int c1 = abs(arr[j] - t);
      int c2 = abs(arr[j] - (t + 1));
      int c3 = abs(arr[j] - (t - 1));
      cost += min({c1, c2, c3});
    }
    if (min_cost >= cost) {
      min_cost = cost;
      ans_t = t;
    }
  }
  cout << ans_t << " " << min_cost << endl;
  return 0;
}
