#include<iostream>
#define f(X) for(c=0;c<X;c+=v[p++]);if(c-X)continue;
using namespace std;main(){for(int n,v[50],s,p,c;cin>>n,n;){string t;for(s=0;s<n;)cin>>t,v[++s]=t.size();for(s=p=1;p=++s;){f(5)f(7)f(5)f(7)f(7)cout<<s<<endl;p=0;}}}