#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;
    string s;
    vector<long long> len;
    for (long long i = (0); i < (n); ++i) {
      cin >> s;
      len.push_back(s.size());
    }
    long long ans = 0;
    for (long long i = (0); i < (n); ++i) {
      vector<long long> v;
      v.push_back(0);
      if (ans != 0) break;
      for (long long j = (i); j < (n); ++j) {
        if (v.size() == 1) {
          if (v[0] + len[j] > 5)
            break;
          else if (v[0] + len[j] < 5) {
            v[0] += len[j];
          } else {
            v[0] = 5;
            v.push_back(0);
          }
        } else if (v.size() == 2) {
          if (v[1] + len[j] > 7)
            break;
          else if (v[1] + len[j] < 7) {
            v[1] += len[j];
          } else {
            v[1] = 7;
            v.push_back(0);
          }
        } else if (v.size() == 3) {
          if (v[2] + len[j] > 5)
            break;
          else if (v[2] + len[j] < 5) {
            v[2] += len[j];
          } else {
            v[2] = 5;
            v.push_back(0);
          }
        } else if (v.size() == 4) {
          if (v[3] + len[j] > 7)
            break;
          else if (v[3] + len[j] < 7) {
            v[3] += len[j];
          } else {
            v[3] = 7;
            v.push_back(0);
          }
        } else if (v.size() == 5) {
          if (v[4] + len[j] > 7)
            break;
          else if (v[4] + len[j] < 7) {
            v[4] += len[j];
          } else {
            v[4] = 7;
            v.push_back(0);
            ans = i;
            break;
          }
        }
      }
    }
    cout << ans + 1 << endl;
  }
}
