#include <bits/stdc++.h>
using namespace std;
int a[41];
int x[] = {5, 7, 5, 7, 7};
int main() {
  int n;
  string s;
  while (cin >> n, n) {
    for (int i = (0); i < (n); ++i) {
      cin >> s;
      a[i] = s.size();
    }
    int ans = -1;
    for (int i = (0); i < (n - 5); ++i) {
      int cur = 0, sum = 0;
      for (int j = (i); j < (n); ++j) {
        sum += a[j];
        if (sum >= x[cur]) {
          if (sum == x[cur]) {
            ++cur;
            sum = 0;
            if (cur == 5) {
              ans = i + 1;
              break;
            }
          } else
            break;
        }
        if (ans != -1) break;
      }
      if (ans != -1) {
        cout << ans << endl;
        break;
      }
    }
  }
  return 0;
}
