#include<stdio.h>
#include<math.h>
#define R(i,n) for(i=0;i<n;i++)
#define D double
main(){int i,s,a,c,n,l[256],x,y,z;while(scanf("%d",&n),n){R(i,n)scanf("%d",&l[i]);D m=1e9;R(s,16)R(a,16)R(c,16){int u[256]={0};int r=s;R(i,n){r = (a*r + c)&255;u[(r+l[i])&255]++;}D t=0;R(i,256)if(u[i]){t-=u[i]*log((D)u[i]/n);if(m+1e-9<t)break;}if(m>t+1e-9){m=t;x=s;y=a;z=c;}}printf("%d %d %d\n",x,y,z);}}