#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  while(cin>>n,n) {
    int M = 256;
    int I[n]; FOR(i,0,n) cin >> I[i];
    int ans[3];
    double mn = 1e18;
    FOR(S,0,16) {
      FOR(A,0,16) {
        FOR(C,0,16) {
          int R[n+1];
          R[0] = S;
          FOR(i,1,n+1) R[i] = (A * R[i-1] + C) % M;
          int O[n];
          FOR(i,0,n) O[i] = (I[i] + R[i+1]) % M;
          double H = 0;
          int num[300]; CLR(num);
          FOR(i,0,n) num[O[i]]++;
          FOR(i,0,300) {
            if(num[i] == 0) continue;
            H += num[i] * log((double)num[i] / n);
          }
          H = -H;
          if(H + 1e-9 < mn) {
            ans[0] = S;
            ans[1] = A;
            ans[2] = C;
            mn = H;
          }
        }
      }
    }
    FOR(i,0,3) {
      if(i) cout << " ";
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}