#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
int main() {
  int N;
  while (1) {
    cin >> N;
    if (N == 0) {
      break;
    }
    vector<int> V;
    for (int i = 0; i < N; i++) {
      string S;
      cin >> S;
      V.push_back((int)S.size());
    }
    for (int i = 0; i < N; i++) {
      int sum = 0;
      int now = i;
      while (now < N && sum < 31) {
        sum += V[now];
        now++;
      }
      if (sum == 31) {
        cout << i + 1 << endl;
        break;
      }
    }
  }
  return 0;
}
