#include <bits/stdc++.h>
using namespace std;
int main(void) {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    int len[n + 1];
    for (int i = 1; i <= n; ++i) {
      string w;
      cin >> w;
      len[i] = w.length();
    }
    int cumulativesum[n + 1];
    cumulativesum[1] = len[1];
    for (int i = 2; i <= n; ++i) {
      cumulativesum[i] = cumulativesum[i - 1] + len[i];
    }
    bool cnt5 = false, cnt12 = false, cnt17 = false, cnt24 = false,
         cnt31 = false;
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i; j <= n; ++j) {
        if (cumulativesum[j] == 5) cnt5 = true;
        if (cumulativesum[j] == 12) cnt12 = true;
        if (cumulativesum[j] == 17) cnt17 = true;
        if (cumulativesum[j] == 24) cnt24 = true;
        if (cumulativesum[j] == 31) cnt31 = true;
        if (cnt5 && cnt12 && cnt17 && cnt24 && cnt31) ans = i;
      }
      if (ans != 0) break;
      for (int j = 1; j <= n; ++j) {
        cumulativesum[j] -= len[i];
      }
    }
    cout << ans << endl;
  }
  return 0;
}
