#include #include using namespace std; int main() { int n; int temp; while(scanf("%d",&n)==1) { if(!n) break; int ans,i; for(i=0,ans=0;i