while 1:
    n = input()
    if n==0:break
    L = map(len, [raw_input() for i in xrange(n)])
    pair = [5, 7, 5, 7, 7]
    for i in xrange(n):
        idx = 0
        cnt = 0
        for j in xrange(i, n):
            cnt += L[j]
            if cnt == pair[idx]:
                idx += 1
                cnt = 0
                if idx == 5:
                    print i+1
                    break
            elif cnt > pair[idx]:
                break
        if idx==5:break