#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v;
  int n, t = 0, count = 0, tt;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    v.resize(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int j = 0; j < n; j++) {
      for (int i = j; i < n; i++) {
        if (count == 0) {
          t += v[i].size();
          if (t == 5)
            count++;
          else if (t > 5) {
            count = 0;
            t = 0;
            break;
          }
        } else if (count == 1) {
          t += v[i].size();
          if (t == 12)
            count++;
          else if (t > 12) {
            count = 0;
            t = 0;
            break;
          }
        } else if (count == 2) {
          t += v[i].size();
          if (t == 17)
            count++;
          else if (t > 17) {
            t = 0;
            count = 0;
            break;
          }
        } else if (count == 3) {
          t += v[i].size();
          if (t == 24)
            count++;
          else if (t > 24) {
            t = 0;
            count = 0;
            break;
          }
        } else if (count == 4) {
          t += v[i].size();
          if (t == 31) {
            count++;
            break;
          } else if (t > 31) {
            t = 0;
            count = 0;
            break;
          }
          tt = j + 1;
        }
      }
      if (count == 5) {
        cout << tt << endl;
        t = 0;
        count = 0;
        break;
      }
    }
  }
}
