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

int main(){
  int N, M = 256;
  while(cin >> N, N){
    int l[N], s = -1, a = -1, c = -1;
    long double H = (1e10);
    for(int i = 0; i < N; ++i)
      cin >> l[i];
    for(int S = 0; S < 16; ++S){
      for(int A = 0; A < 16; ++A){
	for(int C = 0; C < 16; ++C){
	  vector<int> V(M,0);
	  int R = S;
	  for(int i = 0; i < N; ++i){
	    R = (A*R+C)%M;
	    ++V[(l[i]+R)%M];
	  }

	  double t = 0.0;
	  for(int i = 0; i < M; ++i)
	    if(V[i]) t -= (double)V[i]/N*log((double)V[i]);

	  if(t < H){
	    s = S;
	    a = A;
	    c = C;
	    H = t;
	  }
	}
      }
    }
    printf("%d %d %d\n", s, a, c);
  }
  return 0;
}