#include <stdio.h>
#include <string.h>

int main(void)
{
    int n;
    int W[40];
    char word[11];
    int i, j;
    int len;
    
    while (1){
        scanf("%d", &n);
        if (n == 0){
            break;
        }
        
        for (i = 0; i < n; i++){
            scanf("%s", word);
            W[i] = strlen(word);
        }
        
        for (i = 0; i < 40; i++){
            len = 0;
            j = 0;
            while (len < 5){
                len += W[i + j];
                j++;
            }
//printf("[1:len=%d, j=%d]", len, j);
            if (len != 5){
                continue;
            }
            
            len = 0;
            while (len < 7){
                len += W[i + j];
                j++;
            }
//printf("[2:len=%d, j=%d]", len, j);
            if (len != 7){
                continue;
            }

            len = 0;
            while (len < 5){
                len += W[i + j];
                j++;
            }
//printf("[3:len=%d, j=%d]", len, j);
            if (len != 5){
                continue;
            }

            len = 0;
            while (len < 7){
                len += W[i + j];
                j++;
            }
//printf("[4:len=%d, j=%d]", len, j);
            if (len != 7){
                continue;
            }

            len = 0;
            while (len < 7){
                len += W[i + j];
                j++;
            }
//printf("[5:len=%d, j=%d]", len, j);
            if (len != 7){
                continue;
            }
            printf("%d\n", i + 1);
            break;
        }
    }
    return (0);
}

