#include<stdio.h>

int main(void){
	int m;
	int i, j;
	int pos;
	int ct1 = 0;
	int ct2 = 0;
	int ct3 = 0;
	int ct4 = 0;
	int ct5 = 0;
	int flag = 0;
	char ch[40][11] = {{'\0'}};
	
	while(1){
	scanf("%d", &m);
	if ( m == 0 ) {
		break;
	}
	for ( i = 0; i < m; i++ ) {
		scanf("%s", ch[i]);
	}
	
	for ( i = 0; i < m; i++ ) {
		pos = i;
		ct1 += strlen(ch[i]);
		for ( j = i + 1; j < m; j++ ) {
			if ( ct1 > 5 || ct2 > 7 || ct3 > 5 || ct4 > 7 || ct5 > 7 ) {
				ct1 = 0;
				ct2 = 0;
				ct3 = 0;
				ct4 = 0;
				ct5 = 0;
				break;
			} else if ( ct1 < 5 ) {
				ct1 += strlen(ch[j]);
			} else if ( ct2 < 7 ) {
				ct2 += strlen(ch[j]);
			} else if ( ct3 < 5 ) {
				ct3 += strlen(ch[j]);
			} else if ( ct4 < 7 ) {
				ct4 += strlen(ch[j]);
			} else if ( ct5 < 7 ) {
				ct5 += strlen(ch[j]);
			} else {
				flag = 1;
				break;
			}
		}
		if ( flag ) {
			break;
		}
	}
	printf("%d\n", pos);
	}
	return 0;
}
