#include <bits/stdc++.h>
int i, j, d[50], p, n, q, a[5] = {5, 7, 5, 7, 7};
char s[15];
int main() {
  for (n = 1; n;) {
    scanf("%d\n", &n);
    for (i = 0; i < n; i++) d[i] = strlen(gets(s));
    for (i = 0; i < n; i++) {
      p = i;
      for (j = 0; j < 5; j++) {
        q = a[j];
        while (q > 0) {
          q -= d[p];
          p++;
        }
        if (q) p = -1;
      }
      if (p > 0) {
        printf("%d\n", i + 1);
        break;
      }
    }
  }
}
