#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  while (1) {
    int n, i, j;
    vector<string> str;
    cin >> n;
    if (n == 0) {
      break;
    }
    string tmp;
    for (i = 0; i < n; i++) {
      cin >> tmp;
      str.push_back(tmp);
    }
    for (i = 0; i < n; i++) {
      int flag = 0;
      j = i;
      int numsum = 0;
      while (1) {
        if (flag == -1) {
          break;
        }
        if (flag == 5) {
          cout << i + 1 << endl;
          break;
        }
        numsum += str[i + j].length();
        if (flag == 0 || flag == 2) {
          if (numsum > 5) {
            flag = -1;
          } else if (numsum < 5) {
            j++;
          } else if (numsum == 5) {
            flag++;
            numsum = 0;
            j++;
          }
        } else {
          if (numsum > 7) {
            flag = -1;
          } else if (numsum < 7) {
            j++;
          } else if (numsum == 7) {
            flag++;
            numsum = 0;
            j++;
          }
        }
      }
      if (flag == 5) {
        break;
      }
    }
  }
  return 0;
}
