#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    string word;
    int *length = new int[n];
    int key[5] = {5, 7, 5, 7, 7};
    for (int i = 0; i < n; i++) {
      cin >> word;
      length[i] = word.size();
      cout << length[i] << endl;
    }
    int count = 0;
    int section = 0;
    int index = 0;
    int output = 0;
    int start = 0;
    bool found = false;
    while (index != n) {
      index = output;
      output++;
      while (count <= 5) {
        if (key[count] > section) {
          section += length[index++];
        } else if (key[count] == section) {
          section = 0;
          count++;
        } else {
          break;
        }
        if (count == 5) {
          cout << output << endl;
          found = true;
        }
      }
      count = 0;
      section = 0;
      if (found) break;
    }
  }
  return 0;
}
