#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int f = 0;
    long long ans = INT_MAX;
    int in = INT_MAX;
    for (int j = 1; j <= 101; j++) {
      f = 0;
      long long cost = 0;
      for (int i = 0; i < n; i++) {
        cost +=
            min(abs(arr[i] - j + 1), min(abs(arr[i] - j), abs(arr[i] - j - 1)));
      }
      if (f == 0 && cost < ans) {
        ans = cost;
        in = j;
      }
    }
    cout << in << " " << ans;
  }
  return 0;
}
