#include <bits/stdc++.h>
using namespace std;

int phrase[5] = {5,7,5,7,7};

int main() {

    while(1){

        int n;

        cin >> n;

        if(n==0) break;

        vector<string> w;

        for(int i=0; i<n; i++){
            string input;
            cin >> input;
            w.push_back(input);
        }

        int w_pos = 0;

        while(1){

            int w_itr = w_pos, nowp = 0, pcount = 0;

            while(1){
                if(w[w_itr].size() + pcount > phrase[nowp]){
                    nowp = -1;
                    break;
                }
                else if(w[w_itr].size() + pcount == phrase[nowp]){
                    nowp++;
                    if(nowp == 5){
                        break;
                    }
                    pcount = 0;
                }
                else{
                    pcount += w[w_itr].size();
                }
                w_itr++;
            }

            if(nowp == 5){
                break;
            }#include <bits/stdc++.h>
using namespace std;

int phrase[5] = {5,7,5,7,7};

int main() {

    while(1){

        int n;

        cin >> n;

        if(n==0) break;

        vector<string> w;

        for(int i=0; i<n; i++){
            string input;
            cin >> input;
            w.push_back(input);
        }

        int w_pos = 0;

        while(1){

            int w_itr = w_pos, nowp = 0, pcount = 0;

            while(1){
                if(w[w_itr].size() + pcount > phrase[nowp]){
                    nowp = -1;
                    break;
                }
                else if(w[w_itr].size() + pcount == phrase[nowp]){
                    nowp++;
                    if(nowp == 5){
                        break;
                    }
                    pcount = 0;
                }
                else{
                    pcount += w[w_itr].size();
                }
                w_itr++;
            }

            if(nowp == 5){
                break;
            }

            w_pos++;


        }

        cout << w_pos + 1 << endl;

    }

    return 0;
}

            w_pos++;


        }

        cout << w_pos + 1 << endl;

    }

    return 0;
}