#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 1e18;
int dx[4] = {0, -1, 1, 0}, dy[4] = {-1, 0, 0, 1};
int main() {
  ios::sync_with_stdio(false);
  vector<int> length = {5, 7, 5, 7, 7};
  int N;
  while (cin >> N || N) {
    vector<string> S(N);
    for (int i = 0; i < (int)(N); i++) cin >> S[i];
    for (int i = 0; i < N; i++) {
      int current = 0;
      int step = 0;
      bool ok = false;
      for (int j = i; j < N; j++) {
        if (current < length[step]) {
          current += S[j].size();
        }
        if (current > length[step]) {
          step = 0;
          current = 0;
        }
        if (current == length[step]) {
          step++;
          current = 0;
        }
        if (step == length.size()) {
          ok = true;
          cout << i + 1 << endl;
          break;
        }
      }
      if (ok) break;
    }
  }
}
