using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication17
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            List<string> a = new List<string>();
               int b = 0;
               for (int i = 0; i < n; i++)
               {
                   a.Add(Console.ReadLine());
               }
               foreach (string x in a)
                   if ((x.Length < 5) || (x[0] == 'A'))
                       b = b + 1;
               Console.WriteLine(b);
               Console.ReadKey();

        }
    }
}
