#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
int tx[] = {0, 1, 0, -1};
int ty[] = {-1, 0, 1, 0};
int main() {
  int num_word;
  while (~scanf("%d", &num_word)) {
    if (num_word == 0) break;
    vector<string> words;
    for (int word_i = 0; word_i < num_word; word_i++) {
      string word;
      cin >> word;
      words.push_back(word);
    }
    int res = 0;
    for (int start = 0; start < num_word; start++) {
      bool has_end[50];
      memset(has_end, 0, sizeof(has_end));
      int pos = 0;
      for (int word_i = start; word_i < num_word; word_i++) {
        pos += words[word_i].size();
        has_end[pos] = true;
      }
      if (has_end[5] && has_end[5 + 7] && has_end[5 + 7 + 5] &&
          has_end[5 + 7 + 5 + 7] && has_end[5 + 7 + 5 + 7 + 7]) {
        res = start + 1;
        break;
      }
    }
    printf("%d\n", res);
  }
}
