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