#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  constexpr int len[5] = {5, 7, 5, 7, 7};
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      l[i] = s.size();
    }
    for (int i = 0; i < n; i++) {
      int ind = 0;
      int sum = 0;
      for (int j = i; j < n; j++) {
        if (ind == 5) {
          break;
        }
        sum += l[j];
        if (sum > len[ind]) {
          break;
        } else if (sum == len[ind]) {
          ind++;
          sum = 0;
        }
      }
      if (ind == 5) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}
