using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = Console.ReadLine().Trim().Length;
            for (int p = 0; p < n; p++)
            {
                var fcond = 1; var lcount = 0; var startpoint = p; var found57577 = 0;
                for (int i = p; i < n; i++)
                {
                    switch (fcond)
                    {
                        case 1: 
                            if (lcount + a[i] < 5) lcount += a[i];
                            else if (lcount + a[i] == 5)
                            {
                                fcond++;
                                lcount = 0;
                            }
                            else { goto exit; }
                            break;
                        case 2:  
                            if (lcount + a[i] < 7) lcount += a[i];
                            else if (lcount + a[i] == 7)
                            {
                                fcond++;
                                lcount = 0;
                            }
                            else { goto exit; }
                            break;
                        case 3:  
                            if (lcount + a[i] < 5) lcount += a[i];
                            else if (lcount + a[i] == 5)
                            {
                                fcond++;
                                lcount = 0;
                            }
                            else { goto exit; }
                            break;
                        case 4:  
                            if (lcount + a[i] < 7) lcount += a[i];
                            else if (lcount + a[i] == 7)
                            {
                                fcond++;
                                lcount = 0;
                            }
                            else { goto exit; }
                            break;
                        case 5: 
                            if (lcount + a[i] < 7) lcount += a[i];
                            else if (lcount + a[i] == 7)
                            {
                                fcond++;
                                lcount = 0;
                                found57577 = 1;
                                goto exit;
                            }
                            else {  goto exit; }
                            break;
                    }
                }
                exit:;
                if (found57577 == 1)
                {
                    Console.WriteLine(startpoint + 1);
                    goto bigloopend;
                }
                loopend:;
            }
            bigloopend:;
        }
    }
}