// Aizu 1601: Short Phrase
// 2017.9.21 bal4u@uu

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

int w[42];
int a[5] = { 5,7,5,7,7 };

int main()
{
	int n, i, j, k, ans, s;
	char t[15];

	while (scanf("%d", &n) && n) {
		for (ans = 0, i = 0; i < n; i++) scanf("%s", t), w[i] = strlen(t);
		for (i = 0; i < n; i++) for (k = s = 0, j = i; j < n; j++) {
			s += w[j];
			if (s == a[k]) {
				s = 0;
				if (++k == 5) { ans = i+1; goto Done; }
			} else if (s > a[k]) break;
		}
Done:	printf("%d\n", ans);
	}
	return 0;
}