#include <bits/stdc++.h>
using namespace std;
long long int dx[] = {1, -1, 0, 0};
long long int dy[] = {0, 0, 1, -1};
long long int n, m;
long long int a, b;
long long int p, q;
signed main() {
  while (1) {
    (cin >> n);
    if (n == 0) break;
    vector<string> str(n);
    for (long long int i = (0); i < (n); ++i) {
      (cin >> str[i]);
    }
    long long int ans = 0;
    for (long long int i = (0); i < (n); ++i) {
      long long int idx = 0;
      ans = i;
      vector<long long int> check = {5, 7, 5, 7, 7};
      for (long long int j = (i); j < (n); ++j) {
        if (check[idx] <= 0) {
          idx++;
        }
        if (idx == 6) {
          break;
        }
        check[idx] -= str[j].size();
      }
      long long int sum = 0;
      for (long long int k = (0); k < (5); ++k) {
        sum += check[k];
      }
      if (sum == 0) {
        break;
      }
    }
    (cout << ans + 1 << endl);
  }
  return 0;
}
