#include <iostream>
using namespace std;
bool is_equal(int* x, int n) {
    for (int i = 0; i < n - 1; ++i) {
        if (!(x[i] == x[i + 1])) {
            return false;
        }
    }
    return true;
}
int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        if (n == 0) {
            break;
        }
        int candy[n];
        int candy_copy[n];
        int count = 0;
        for (int i = 0; i < n; ++i) {
            scanf("%d", &candy[i]);
        }
//        for (int i = 0; i < n; ++i) {
//            if(candy[i]%2==1){candy[i]++;}
//        }
        while (!is_equal(candy, n)) {
            for (int i = 0; i < n; ++i) {
//
                if (candy_copy[(i + 1) % n] % 2 == 1) {
                    candy_copy[(i + 1) % n] = (candy[(i + 1) % n]) / 2 + (candy[i % n]) / 2;
                } else {
                    candy_copy[(i + 1) % n] = (candy[(i + 1) % n] + 1) / 2 + (candy[i % n]) / 2;
                }
                if (candy_copy[(i + 1) % n] % 2 == 1) {
                    candy_copy[(i + 1) % n]++;
                }
            }
            copy(candy_copy, candy_copy + n, candy);
            count++;
        }
        printf("%d %d\n", count, candy[0]);
    }
    return 0;
}