#include<iostream>
using namespace std;
typedef struct LNode *List;
struct LNode
{
int data;
List next;
};
void Init(List &s)
{
s = new LNode;
s->next = NULL;
}
void CreatList(List &L, int n)
{
List r, p;
r = L;
for (int i = 0; i < n; i++)
{
p = new LNode;
cin >> p->data;
r->next = p;
r = p;
}
r->next = NULL;
}
int GetLength(List p)
{
if (p->next== NULL)
return 0;
return 1 + GetLength(p->next);
}
int main()
{
List a;
int n;
while (cin >> n && n != 0)
{
Init(a);
CreatList(a, n);
cout << GetLength(a) << endl;
}
return 0;
}