#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
using namespace std;

const int MOD = 256;
const double EPS = 1e-7;
const int INF = 1<<29;
int n,I[257],R[257],O[257];
vector<int> sharp;

bool equal(double a, double b){
  return fabs(a-b) < EPS;
}

void makeR(int S, int A, int C){
  R[0] = S;
  for(int i=1;i<=n;i++){
    R[i] = (A * R[i-1] + C) % MOD;
  }
}

void makeO(){
  map<int,int> mp;
  sharp.clear();

  for(int i=1;i<=n;i++){
    O[i] = (I[i] + R[i]) % MOD;
    if(mp.find(O[i]) == mp.end()) mp[O[i]] = 1;
    else mp[O[i]]++;
  }

  for(map<int,int>::iterator it = mp.begin(); it != mp.end(); it++)
    sharp.push_back(it->second);
}

double calcH(){
  double H = 0, N = (double)n;
  for(int i=0;i<sharp.size();i++){
    double x = (double)sharp[i];
    H += (x / N) * log(x / N);
  }
  return H * -1.0;
}

void solve(){
  vector<int> sharp;
  double H, ans = (double)INF;
  int sum = INF, as, aa, ac;
  for(int S=0;S<=15;S++){
    for(int A=0;A<=15;A++){
      for(int C=0;C<=15;C++){
        makeR(S,A,C);
        makeO();
        H = calcH();
        if(ans > H && !equal(ans,H) /*|| equal(ans,H) && sum > S+A+C*/){
          ans = H;
          sum = S+A+C;
          as = S;
          aa = A;
          ac = C;
        }
      }
    }
  }
  cout << as << ' ' << aa << ' ' << ac << endl;
}

int main(){
  while(cin >> n && n){
    for(int i=1;i<=n;i++){
      cin >> I[i];
    }
    solve();
  }
}