#include <bits/stdc++.h>
using namespace std;
int n;
int b[50];
bool c(int r) {
  int g[] = {5, 7, 5, 7, 7};
  int d = 0, k;
  int q = 0;
  for (int j = r; j < n; j++) {
    if (k == 5) return true;
    d += b[j];
    if (d == g[q]) {
      d = 0;
      q++;
      continue;
    } else if (d < g[q])
      continue;
    else
      return false;
  }
}
int main() {
  string a;
  while (1) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < (int)(n); i++) {
      cin >> a;
      b[i] = a.size();
    }
    for (int i = 0; i < (int)(n); i++) {
      if (c(i)) {
        cout << i + 1 << endl;
        break;
      }
    }
  }
  return 0;
}
