#include <bits/stdc++.h>
using namespace std;
int a0 = 5;
int a1 = 7;
int a2 = 5;
int a3 = 7;
int a4 = 7;
int main() {
  int n;
  while (cin >> n, n != 0) {
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
      string str;
      cin >> str;
      int x = str.size();
      v[i] = x;
    }
    for (int i = 0; i < n; i++) {
      int k = i;
      int ans = i;
      int a = a0;
      while (a > 0) {
        a -= v[k];
        k++;
        if (k == n) {
          goto OUT;
        }
        if (a == 0) {
          break;
        } else if (a < 0) {
          goto OUT;
        }
      }
      a = a1;
      while (a > 0) {
        a -= v[k];
        k++;
        if (k == n) {
          goto OUT;
        }
        if (a == 0) {
          break;
        } else if (a < 0) {
          goto OUT;
        }
      }
      a = a2;
      while (a > 0) {
        a -= v[k];
        k++;
        if (k == n) {
          goto OUT;
        }
        if (a == 0) {
          break;
        } else if (a < 0) {
          goto OUT;
        }
      }
      a = a3;
      while (a > 0) {
        a -= v[k];
        k++;
        if (k == n) {
          goto OUT;
        }
        if (a == 0) {
          break;
        } else if (a < 0) {
          goto OUT;
        }
      }
      a = a4;
      while (a > 0) {
        a -= v[k];
        k++;
        if (k == n) {
          goto OUT;
        }
        if (a == 0) {
          cout << ans + 1 << endl;
        } else if (a < 0) {
          goto OUT;
        }
      }
    OUT:;
    }
  }
  return 0;
}
