#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    int phraseCount[] = {5, 7, 5, 7, 7};
    int currentPhraseIndex = 0;
    int currentPhraseCount = 0;
    string phrases[n];
    for (int i = 0; i < n; i++) {
      cin >> phrases[i];
    }
    bool foundAnser = false;
    for (int k = 0; k < n; k++) {
      for (int i = k; i < n; i++) {
        string s;
        s = phrases[i];
        currentPhraseCount += s.length();
        if (currentPhraseCount == phraseCount[currentPhraseIndex]) {
          currentPhraseIndex++;
          currentPhraseCount = 0;
          if (currentPhraseIndex == 5) {
            cout << k + 1 << endl;
            for (int j = i + 1; j < n; j++) {
              cin >> s;
            }
            foundAnser = true;
            break;
          }
        } else if (currentPhraseCount > phraseCount[currentPhraseIndex]) {
          currentPhraseIndex = 0;
          currentPhraseCount = 0;
          break;
        }
      }
      if (foundAnser) {
        break;
      }
    }
  }
  return 0;
}
