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

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