#include <bits/stdc++.h>
using ll = long long;
int main() {
  int n;
  std::cin >> n;
  std::vector<int> v(n);
  int max_val{};
  for (auto &val : v) {
    std::cin >> val;
    max_val = std::max(max_val, val);
  }
  int t{1}, min_val{std::numeric_limits<int>::max()};
  for (int i{1}; i <= max_val; ++i) {
    int current{};
    for (int j{}; j < n; ++j) {
      current += std::max(0, std::abs(v[j] - i) - 1);
    }
    if (current < min_val) {
      t = i;
      min_val = current;
    }
  }
  printf("%d %d\n", t, min_val);
}
