#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  const int tank[] = {5, 7, 5, 7, 7};
  while (cin >> n && n) {
    vector<int> w(n);
    for (int i = 0; i < n; i++) {
      string ww;
      cin >> ww;
      w[i] = ww.length();
    }
    int ans = -1;
    for (int i = 0; i < n - 5; i++) {
      int tmp = 0;
      int cnt = 0;
      for (int j = i; j < n; j++) {
        tmp += w[j];
        if (tmp < tank[cnt]) {
        } else if (tmp == tank[cnt]) {
          tmp = 0;
          cnt++;
          if (cnt == 5) {
            ans = i + 1;
            goto FIN;
          }
        } else {
          break;
        }
      }
    }
  FIN:
    cout << ans << endl;
  }
  return 0;
}
