#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define N 40

static int d[N];
static int n;

nextint(fp)
FILE *fp;
{
  int rval = 0;
  int ch;
  
  do {
    ch = fgetc(fp);
  } while (isspace(ch));
  for (; isalpha(ch); ch = fgetc(fp))
    ++rval;
  ungetc(ch, fp);
  
  return rval;
}

vassert(i, val)
{
  int cval = 0;
  
  for (; i < n && cval < val; ++i)
    cval += d[i];
  if (cval != val)
    return -1;
    
  return i;
}

main()
{
  int i, j;
  
  for (;;) {
    scanf("%d", &n);
    if (n == 0) break ;
    for (i = 0; i < n; ++i)
      d[i] = nextint(stdin);
    
    for (i = 0; i < n; ++i) {
      j = i;
      j = vassert(j, 5);
      if (j < 0) continue ;
      j = vassert(j, 7);
      if (j < 0) continue ;
      j = vassert(j, 5);
      if (j < 0) continue ;
      j = vassert(j, 7);
      if (j < 0) continue ;
      j = vassert(j, 7);
      if (j < 0) continue ;
      printf("%d\n", i + 1);
      break ;
    }
  }

  return EXIT_SUCCESS;
}