#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m = 256;

    while (cin >> n && n) {
        VI i(n);
        REP(j,n) cin >> i[j];
        double mi = 1e9;
        int sa, aa, ca;
        REP(s,16) REP(a,16) REP(c,16) {
            VI r(n+1), o(n);
            r[0] = s;
            REP(j,n) r[j+1] = (a*r[j] + c) % m;
            REP(j,n) o[j] = (i[j] + r[j+1]) % m;
            vector<double> p(m);
            REP(j,n) p[o[j]] += 1.0;
            double h = 0.0;
            REP(j,m) if(p[j]>0) h -= p[j]/n * log(p[j]/n);
            if (h < mi - 1e-10) {
                mi = h;
                sa = s;
                aa = a;
                ca = c;
            }
        }
        printf("%d %d %d\n", sa, aa, ca);
    }

    return 0;
}