#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool debug = false;
int haiku[45];
int num[6] = {5, 7, 5, 7, 7, 0};
void solve(int n) {
  int s = 0, e = 0, cnt = 0, sum = haiku[0];
  int dast = 0;
  for (int i = 0; i < int(n - 5); i++) {
    dast = cnt = 0;
    s = e = i;
    sum = haiku[i];
    while (s != n && e != n) {
      if (debug)
        cout << "s: " << s << "  e:" << e << "  cheack( " << cnt
             << " ): " << num[cnt] << "  dast: " << dast << "  cnt: " << cnt
             << endl;
      if (cnt == 5) break;
      if (sum == num[cnt]) {
        s = e = e + 1;
        sum = haiku[s];
        cnt++;
      } else if (sum < num[cnt]) {
        e++;
        sum += haiku[e];
      } else if (sum > num[cnt]) {
        break;
      }
    }
    if (debug) cout << endl;
    if (debug)
      cout << "s: " << s << "  e:" << e << "  cheack( " << cnt
           << " ): " << num[cnt] << "  dast: " << dast << "  cnt: " << cnt
           << endl;
    if (cnt == 5) {
      cout << i + 1 << endl;
      break;
    }
  }
}
int main() {
  int n;
  string s;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0; i < int(n); i++) {
      cin >> s;
      haiku[i] = s.size();
    }
    solve(n);
  }
}
