#include <bits/stdc++.h>
using namespace std;
int main() {
  for (int n, v[50], s, p, c; cin >> n, n;) {
    for (s = 1; s < n; s++) {
      string t;
      cin >> t;
      v[s] = t.size();
    }
    for (s = p = 1;; p = ++s) {
      for (c = 0; c < 5; c += v[p++])
        ;
      if (c - 5) continue;
      ;
      for (c = 0; c < 7; c += v[p++])
        ;
      if (c - 7) continue;
      ;
      for (c = 0; c < 5; c += v[p++])
        ;
      if (c - 5) continue;
      ;
      for (c = 0; c < 7; c += v[p++])
        ;
      if (c - 7) continue;
      ;
      for (c = 0; c < 7; c += v[p++])
        ;
      if (c - 7) continue;
      ;
      cout << s << endl;
      break;
    }
  }
}
