#include <bits/stdc++.h>
using namespace std;
int n, len, ans, cnt, tanka[5] = {5, 7, 5, 7, 7};
string s[50];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  while (true) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; ++i) {
      cin >> s[i];
    }
    cnt = len = ans = 0;
    for (int i = 0; i < n; ++i) {
      ans = i + 1;
      len = 0;
      for (int j = i; j < n; ++j) {
        len += s[j].size();
        if (len == tanka[cnt]) {
          cnt++;
          len = 0;
          if (cnt == 5) {
            cout << ans << endl;
            return 0;
          }
        } else if (len < tanka[cnt]) {
          continue;
        } else if (len > tanka[cnt]) {
          len = 0;
          cnt = 0;
          break;
        }
      }
    }
    for (int i = 0; i < 49; ++i) s[i] = "";
  }
  return 0;
}
