#include <bits/stdc++.h>
using namespace std;
using ld = long double;

const int mod = 0xff;
const ld eps = 1e-10;

int main()
{
	int N;
	while (cin >> N, N) {
		vector<int> I(N);
		for (int i = 0; i < N; i++) {
			cin >> I[i];
		}
		int rS = -1, rA = -1, rC = -1;
		ld mH = 1e20;
		for (int S = 0; S < 16; S++) {
			for (int A = 0; A < 16; A++) {
				for (int C = 0; C < 16; C++) {
					vector<int> R(N + 1), O(N + 1), cnt(256);
					R[0] = S;
					for (int i = 1; i <= N; i++) {
						R[i] = (A * R[i - 1] + C) & mod;
					}
					for (int i = 1; i <= N; i++) {
						O[i] = (I[i - 1] + R[i]) & mod;
						cnt[O[i]]++;
					}
					ld H = 0;
					for (int i = 0; i < 256; i++) {
						if (cnt[i]) {
							ld tmp = (ld)cnt[i] / N;
							H -= tmp * logl(tmp);
						}
					}
					if (H + eps < mH) {
						rS = S;
						rA = A;
						rC = C;
						mH = H;
					}
				}
			}
		}
		cout << rS << ' ' << rA << ' ' << rC << endl;
	}
	return 0;
}