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

int main(void){
	int wl[64],tk[8]={0,5,7,5,7,7,0,0},seq,nowl,i,j,n,yn;
	char s[16];
	while(scanf("%d",&n) , n != 0){
		for(i = 1;i <= n;i++){
			scanf("%s",s);
			wl[i] = strlen(s);
		}
		yn = 0;
		for(i = 1;i <= n;i++){
			seq = 1;
			nowl = 0;
			j = i;
			while(1){
				nowl+=wl[j];
				if(nowl == tk[seq]){
					if(seq == 5){
						printf("%d\n",i);
						yn = 1;
						break;
					}
					else{
						seq++;
						nowl = 0;
					}
				}
				else if(nowl > tk[seq]){break;}
				j++;
			}
			if(yn){break;}
		}
	}
	return 0;
}