#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int w[5] = {5, 7, 5, 7, 7};
  while (cin >> n && n) {
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
      string s;
      cin >> s;
      a[i] = s.length();
    }
    for (int s = 0; s < n; ++s) {
      int x = 0, i = s, j = 0, f = 1;
      while (f) {
        x += a[i];
        i++;
        if (x > w[j]) f = 0;
        if (x == w[j]) {
          x = 0;
          j++;
        }
        if (j == 5) break;
      }
      if (f) cout << s + 1 << endl;
    }
  }
  return 0;
}
