#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      return 0;
    }
    string str;
    int nums[41];
    for (int i = 0; i < n; i++) {
      cin >> str;
      nums[i] = str.size();
    }
    int start = 0;
    int tail = 0;
    int sum = 0;
    while (true) {
      while (tail < n && sum < (5 + 7 + 5 + 7 + 7)) {
        tail++;
        sum = 0;
        for (int i = start; i < tail; i++) {
          sum += nums[i];
        }
      }
      if (sum < (5 + 7 + 5 + 7 + 7)) {
        break;
      } else if (sum == (5 + 7 + 5 + 7 + 7)) {
        int ns[5] = {5, 7, 5, 7, 7};
        int s = start;
        int i = 0;
        while (i < 5) {
          if (nums[s] == ns[i]) {
            i++;
            s++;
          } else if (nums[s] > ns[i]) {
            break;
          } else {
            ns[i] = ns[i] - nums[s];
            s++;
          }
        }
        if (i == 5) {
          cout << start + 1 << endl;
          break;
        }
      }
      while (start < tail && sum > (5 + 7 + 5 + 7 + 7)) {
        start++;
        sum = 0;
        for (int i = start; i < tail; i++) {
          sum += nums[i];
        }
      }
    }
  }
  return 0;
}
