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 s = 0;
            int r = 0;
            int p = 0;
            int n = Convert.ToInt32(Console.ReadLine());
            string[] a = new string[n];
            for (int i = 0; i < n; i++)
                a[i] = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < a[i].Length; j++)
                    if (a[i][j] == '5')
                        s = s + 1;
                string b = a[i].Substring(a[i].Length-2, 2);
                r = Convert.ToInt32(b);
                if ((r % 4) == 0)
                    p = p + 1;
            }
            Console.WriteLine(s);
            Console.WriteLine(p);
            Console.ReadKey();
        }


    }
}
