#include int main () { int N; int i; while(scanf("%d", &N)!=EOF) { if(N==0) break; int num[1200], T, p=0; for(int i=0; i