#include int main(void){ int n, i,ct; int data[5000]; while(1){ ct=0; scanf("%d", &n); if(n==0){ break; } for(i=0; i