#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <algorithm>
#include <cstdio>
using namespace std;
int a[1010], n;
int calc(int t)
{
    int sum = 0;
    for (int i = 0; i < n; i++)
        sum += min(abs(a[i] - t), min(abs(a[i] - (t - 1)), abs(a[i] - (t + 1))));
    return sum;
}
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", a + i);
    int ans = 0x3f3f3f3f, ansi = -1, tmp;
    for (int i = 2; i <= 100; i++)
        if ((tmp = calc(i)) < ans)
            ans = tmp, ansi = i;
    printf("%d %d", ansi, ans);
    return 0;
}
