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

int main(void) {
	static const int target[5] = {5, 7, 5, 7, 7};
	int n;
	while (scanf("%d", &n) == 1 && n > 0) {
		int wlen[40];
		int i;
		char w[12];
		int start;
		for (i = 0; i < n; i++) {
			if (scanf("%s", w) != 1) return 1;
			wlen[i] = strlen(w);
		}
		for (start = 0; start < n; start++) {
			int ok = 0;
			int current_phase = 0;
			int current_num = 0;
			for (i = start; i < n; i++) {
				current_num += wlen[i];
				if (current_num > target[current_phase]) {
					break;
				} else if (current_num == target[current_phase]) {
					current_phase++;
					current_num = 0;
					if (current_phase == 5) {
						ok = 1;
						break;
					}
				}
			}
			if (ok) {
				printf("%d\n", start + 1);
				break;
			}
		}
	}
	return 0;
}