#include <bits/stdc++.h>
int main(void) {
  int n, n_l[40], count = 0, cap = 0;
  char w[10];
  scanf("%d", &n);
  int i;
  while (n != 0) {
    for (i = 0; i < n; i++) {
      scanf("%s", w);
      n_l[i] = strlen(w);
    }
    for (i = 0;; i++) {
      count = 0;
      cap = 0;
      while (count < 5) {
        count += n_l[i + cap];
        cap++;
      }
      if (count != 5) continue;
      count = 0;
      while (count < 7) {
        count += n_l[i + cap];
        cap++;
      }
      if (count != 7) continue;
      count = 0;
      while (count < 5) {
        count += n_l[i + cap];
        cap++;
      }
      if (count != 5) continue;
      count = 0;
      while (count < 7) {
        count += n_l[i + cap];
        cap++;
      }
      if (count != 7) continue;
      while (count < 7) {
        count += n_l[i + cap];
        cap++;
      }
      if (count != 7) continue;
      break;
    }
    printf("%d\n", i + 1);
    scanf("%d", &n);
  }
  return 0;
}
