#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    long long n;
    cin >> n;
    if (n == 0) {
      break;
    }
    string name[n];
    for (long long i = 0; i < n; i++) {
      cin >> name[i];
    }
    long long num[n];
    for (long long i = 0; i < n; i++) {
      num[i] = name[i].length();
    }
    for (long long i = 0; i < n; i++) {
      long long len = 0;
      long long now = i;
      while (len < 5) {
        len += num[now];
        now++;
      }
      if (len == 5) {
        len = 0;
        while (len < 7) {
          len += num[now];
          now++;
        }
        if (len == 7) {
          len = 0;
          while (len < 5) {
            len += num[now];
            now++;
          }
          if (len == 5) {
            len = 0;
            while (len < 7) {
              len += num[now];
              now++;
            }
            if (len == 7) {
              len = 0;
              while (len < 7) {
                len += num[now];
                now++;
              }
              if (len == 7) {
                cout << i + 1;
                break;
              }
            }
          }
        }
      }
    }
  }
  return 0;
}
