#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#define maxn 1010
using namespace std;
int num[maxn];
int main() {
    int n;
    while (cin >> n) {
        for (int i = 0; i < n; i++) {
            cin >> num[i];
        }
        int cnt = 0, ans = 0;
        if (n == 1)cout << 0 << " " << num[0] << endl;
        else {
            while (1) {
                cnt++;
                int num1[maxn] = {0};
                for (int i = 0; i < n; i++) {
                    if (num[i] % 2 != 0)num1[i]++;
                    num1[(i + 1) % n] += num[i] / 2; //给糖果
                }
                for (int i = 0; i < n; i++) {
                    num[i] /= 2;
                    num[i] += num1[i];
                    if (num[i] % 2 != 0)num[i]++;
                    //          cout << num[i] << " ";
                }
                //    cout << endl;
                int count = 1, now = num[0];
                for (int i = 1; i < n; i++) {
                    if (num[i] == now)count++;
                }
                if (count == n) {
                    ans = now;
                    break;
                }

            }
            cout << cnt << " " << ans << endl;
        }
    }

}
// 64 位输出请用 printf("%lld")