n = int(input()) l = [] x = 0 for i in range(n): l.append(list(map(int, input().split()))) x += 1 if sum(l[i])/3 < 60 else 0 print(x)
n = int(input()) l = [] x = 0 for i in range(n): l.append(list(map(int, input().split()))) x += 1 if sum(l[i])/3 < 60 else 0 print(x)