using System;
using System.Linq;

namespace _0032
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0, y = 0;////
            while (true)
            {
                string st = Console.ReadLine();
                int[] a = st.Split().Select(int.Parse).ToArray();
                Array.Sort(a);
                if (a[0] == 3 && a[1] == 4 && a[2] == 5) { x++; }
                else if (a[0] == 5 && a[1] == 5 && a[2] == 8)
                { y++; }
            }
            Console.WriteLine(x);
            Console.WriteLine(y);
        }
    }
}