#include<cstdio>
int candy[1000];
int main(){
int i,max,min,n,round;
while(scanf("%d",&n)){
if(!n) break;
min=1000000;
max=-1;
round=0;
for(i=1;i<=n;i++){
scanf("%d",&candy[i]);
max=candy[i]>max?candy[i]:max;
min=candy[i]<min?candy[i]:min;
}
while(max!=min){
for(i=1;i<=n;i++) candy[i]/=2;
candy[0]=candy[n];
for(i=n;i>=1;i--) candy[i]+=candy[i-1];
for(i=1;i<=n;i++) if(candy[i]%2) candy[i]++;
min=1000000;
max=-1;
for(i=1;i<=n;i++){
max=candy[i]>max?candy[i]:max;
min=candy[i]<min?candy[i]:min;
}
round++;
}
printf("%d %d\n",round,max);
}
return 0;
}