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