#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(void){
    int n;
    vector<string> w(n);
    while(true){
        cin >>n;
        if(n==0) break;
        for(int i=0;i<n;i++)
        cin >> w[i];
        int tanku[5]={5,7,5,7,7};
        bool judge=false;
        //?§??????????
        for(int i=0;i<n;i++){
            int place=i;
            //tanku ibannme
            for(int j=0;j<5;j++){
    int sum=0;
    //kasan
    while(place<n){
        sum+=w[place].size();
        place++;
        if(spum>=tanku[j])
        break;
    }if(sum>tanku[j])
    break;
    if(j==4&&sum==tanku[4]){
            cout << i+1 << endl;
            judge=true;
            break;
        }
            }
            if(judge)
break;
        }
    }
return 0;
}