#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long c = gcd(a, b);
  return ((a / c) * (b / c) * c);
}
const long long INF = 1e9 + 7;
const long long N = 1007;
int main() {
  while (1) {
    long long n;
    cin >> n;
    if (n == 0) break;
    long long wa = 0;
    vector<long long> ws;
    string s;
    set<long long> second;
    vector<long long> len;
    second.insert(0);
    long long ans = 0;
    for (long long i = (0); i < (n); ++i) {
      cin >> s;
      len.push_back(s.size());
      wa += s.size();
      second.insert(wa);
      if (second.count(wa - 31) == 1 && ans == 0) {
        ans = i;
      }
    }
    long long k = 0;
    while (1) {
      k += len[ans];
      ans--;
      if (k == 31) break;
    }
    cout << ans + 2 << endl;
  }
}
