#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define f first
#define s second
#define mp make_pair

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int l[256];
int cnt[256];

int main(){
  while(int n = getInt()){
    REP(i,n) l[i] = getInt();

    pair<int, pair<int, int> > ans;
    double ansval = 1e20;

    REP(s,16) REP(a,16) REP(c,16){
      memset(cnt, 0, sizeof(cnt));

      int r = s;
      REP(i,n){
	r = (r * a + c) % 256;
	cnt[(l[i] + r) % 256]++;
      }

      double h = 0.0;

      REP(i,256) if(cnt[i]){
	double tmp = (double)cnt[i] / n;
	h += - tmp * log(tmp);
      }

      if(h + 1e-10 < ansval){
	ans = mp(s, mp(a, c));
	ansval = h;
      }
    }

    printf("%d %d %d\n", ans.f, ans.s.f, ans.s.s);
  }
  return 0;
}