#include <bits/stdc++.h>
const double PI = 3.1415926535897932384626433832795028841971;
const int INF = 100000000;
const double EPS = 1e-10;
const int MOD = 1000000007;
using namespace std;
int n;
string str[40];
void solve() {
  for (int i = 0; i < n; i++) cin >> str[i];
  for (int i = 0; i < n; i++) {
    int cnt[5] = {5, 7, 5, 7, 7};
    for (int j = i; j < n; j++) {
      for (int k = 0; k < 5; k++) {
        if (cnt[k] != 0) {
          cnt[k] -= str[j].size();
          break;
        }
      }
    }
    bool ok = true;
    for (int j = 0; j < 5; j++)
      if (cnt[j] != 0) ok = false;
    if (ok) cout << i + 1 << endl;
  }
}
int main() {
  while (cin >> n) {
    if (n == 0) break;
    solve();
  }
}
