#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0) {
      break;
    }
    vector<int> data(n);
    string s;
    for (int i = 0; i < n; i++) {
      cin >> s;
      data[i] = s.size();
    }
    for (int i = 0; i < n; i++) {
      int a[5] = {0};
      int cc = 0;
      bool h = true;
      a[0] = data[i];
      if (a[0] == 5) {
        cc++;
      } else if (a[0] > 5) {
        continue;
      }
      for (int j = i + 1; j < n; j++) {
        a[cc] += data[j];
        if (cc == 0) {
          if (a[0] == 5) {
            cc++;
          } else if (a[0] > 5) {
            h = false;
            break;
          }
        } else if (cc == 1) {
          if (a[1] == 7) {
            cc++;
          } else if (a[1] > 7) {
            h = false;
            break;
          }
        } else if (cc == 2) {
          if (a[2] == 5) {
            cc++;
          } else if (a[2] > 5) {
            h = false;
            break;
          }
        } else if (cc == 3) {
          if (a[3] == 7) {
            cc++;
          } else if (a[3] > 7) {
            h = false;
            break;
          }
        } else {
          if (a[4] == 7) {
            cc++;
            break;
          } else if (a[4] > 7) {
            h = false;
            break;
          }
        }
      }
      if (h && cc == 5) {
        cout << i + 1 << endl;
      }
    }
  }
  return 0;
}
