#include <bits/stdc++.h>
using namespace std;
int main() {
  int step, flag = 0, n, l, x;
  while (1) {
    cin >> n;
    if (n == 0) {
      break;
    }
    string w[n];
    for (int i = 0; i < n; i++) {
      cin >> w[i];
    }
    for (int i = 0; i < n - 5; i++) {
      l = 0;
      step = 1;
      flag = 0;
      x = i;
      while (1) {
        if (flag == 1) {
          break;
        }
        l += w[x].length();
        switch (step) {
          case 1:
            if (l > 5) {
              flag = 1;
            } else if (l == 5) {
              step++;
            }
            break;
          case 2:
            if (l > 12) {
              flag = 1;
            } else if (l == 12) {
              step++;
            }
            break;
          case 3:
            if (l > 17) {
              flag = 1;
            } else if (l == 17) {
              step++;
            }
            break;
          case 4:
            if (l > 24) {
              flag = 1;
            } else if (l == 24) {
              step++;
            }
            break;
          case 5:
            if (l > 31) {
              flag = 1;
            } else if (l == 31) {
              flag = 2;
            }
            break;
        }
        if (flag == 2) {
          break;
        }
        x++;
      }
      if (flag == 2) {
        x = i + 1;
        break;
      }
    }
    if (flag == 2) {
      cout << x << endl;
    }
  }
  return 0;
}
