#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  while (cin >> n, n) {
    int a[40] = {0}, b[4] = {0}, j = 0, i = 0, c = 0, k = 0;
    for (; j < n; j++) {
      cin >> s;
      a[i++] = s.size();
    }
    for (j = 0; j < 35; j++) {
      if (!a[j]) break;
      for (i = j; i < 40; i++) {
        c += a[i];
        if (c == 5)
          b[0]++;
        else if (b[0] && c == 12)
          b[1]++;
        else if (b[1] && c == 17)
          b[2]++;
        else if (b[2] && c == 24)
          b[3]++;
        else if (b[3] && c == 31) {
          k = j;
          break;
        }
      }
    }
    cout << n - j + 1 << endl;
  }
}
