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

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

int main(void){
	int n, tmp, ans, len[41];
	char str[11];

	while(1){
		scanf("%d", &n);
		if(n == 0) break;
		for(int i=0; i<n; i++){
			scanf("%s", str);
			len[i] = strlen(str);
		}

		int j = tmp = ans =  0;
		for(int i=0; i<n; i++){
			tmp += len[i];
			if(tmp < phrase[j]){
				continue;
			} else if(tmp > phrase[j]){
				tmp =0; ans++; i = ans-1; j=0;
			} else{
				j++;
				tmp =0;
				if(j>=5){
					printf("%d\n", ans+1);
					break;
				}
			}
		}
	}//endwhile

	return 0;
}
