#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct {
    /* data */
    char c[15];
    int len;
}haiku;




int main(){
    haiku h[45];
    int n;
    int t[5] = {5,7,5,7,7};
    int i,j,k;
    int sum,ans;
    int flag = 0;

    while(1){
        
        flag = 0;
        scanf("%d",&n);
        if(n== 0){
            break;
        }
        for(i = 1; i <= n; i++){
            scanf("%s",h[i].c);
            h[i].len = strlen(h[i].c);
        }
        /*
        for(i = 1; i <= n; i++){
            printf("%d\n",strlen(h[i].c));
        }*/
        sum = 0;
        k = 0;
        ans = 0;
        for(i = 1; i < n ;i++){
            sum = h[i].len;
            j = i+1;
            ans = i;
            k = 0;
            while(k < 5){
                if(sum == t[k]){
                    sum = 0;
                    k++;
                }
                sum += h[j].len;
                if(sum > t[k]){
                    break;
                }
                if(k == 4 && sum == t[k]){
                    flag = 1;
                    break;
                }
                if(sum == t[k]){
                    sum = 0;
                    k++;
                }
                j++;
            }
            if(flag == 1){
                break;
            }

            }
            
            printf("%d\n",ans);
            


        }
        return 0;
}
