#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    const int M = 256;

    int N;
    while (cin >> N, N) {
        V I(N);
        rep(i, N) cin >> I[i];

        double mi = 1e9;
        int S, A, C;
        rep(s, 15 + 1) {
            rep(a, 15 + 1) {
                rep(c, 15 + 1) {
                    int r = s;
                    map<int, int> mp;   // O(i), #occurence
                    rep(i, N) {
                        r = (a * r + c) % M;
                        mp[(I[i] + r) % M]++;
                    }

                    double h = 0.;
                    for (auto& p : mp) {
                        h += - p.second * log((p.second * 1.) / N);
                    }

                    if (h + 1e-10 < mi) {
                        mi = h;
                        S = s, A = a, C = c;
                    }
                }
            }
        }

        cout << S << " " << A << " " << C << endl;
    }

}