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

const double eps = 1e-8;
const int M = 256;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<int> l(n);
		for(int i=0; i<n; i++){
			cin >> l[i];
		}
		
		int ans[3]={0,0,0};
		double minH = 1e18;
		for(int s=0; s<=15; s++){
			for(int a=0; a<=15; a++){
				for(int c=0; c<=15; c++){
					vector<int> count(M,0);
					int r=s;
					for(int i=0; i<n; i++){
						r = (a*r +c) %M;
						count[(r+l[i]) %M]++;
					}
					
					double H=0;
					for(int i=0; i<M; i++){
						if(count[i]!=0){
							H += -count[i]*log((double)count[i]/n);
						}
					}
					if(H + eps < minH){
						minH = H;
						ans[0]=s; ans[1]=a; ans[2]=c;
					}
				}
			}
		}
		
		cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
	}
	return 0;
}