using System;
using System.Linq;


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