One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution.

This contest offers n problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution.

Input

The first input line contains a single integer n (1 ≤ n ≤ 1000) — the number of problems in the contest. Then n lines contain three integers each, each integer is either 0 or 1. If the first number in the line equals 1, then Petya is sure about the problem's solution, otherwise he isn't sure. The second number shows Vasya's view on the solution, the third number shows Tonya's view. The numbers on the lines are separated by spaces.

Output

Print a single integer — the number of problems the friends will implement on the contest.

Examples

Input

3
1 1 0
1 1 1
1 0 0


Output

2


Input

2
1 0 0
0 1 1


Output

1

Note

In the first sample Petya and Vasya are sure that they know how to solve the first problem and all three of them know how to solve the second problem. That means that they will write solutions for these problems. Only Petya is sure about the solution for the third problem, but that isn't enough, so the friends won't take it. 

In the second sample the friends will only implement the second problem, as Vasya and Tonya are sure about the solution.
# vowels = ["a", "o", "y", "e", "u", "i"]
# s = list(input().lower())
# ans = ""
# for i in vowels:
#     if i in s:
#         while i in s:
#             s.remove(i)
# for i in range(len(s)):
#     s[i] = "." + s[i]
# print(ans.join(s))


# n = int(input())
# ans = 0
# for i in range(n):
#
#     s = input()
#     if "-" in s:
#         ans -= 1
#     if "+" in s:
#         ans += 1
#
#
# print(ans)

# s1 = input().lower()
# s2 = input().lower()
# isequal = False
# for i in range(len(s1)):
#     if s1[i] > s2[i]:
#         print("1")
#         isequal = True
#         break
#     if s2[i] > s1[i]:
#         print("-1")
#         isequal = True
#         break
# if not isequal:
#     print("0")

# s = list(input())
# not_dangerous = False
# for i in range(len(s)):
#     if i != len(s) - 1:
#         j = 0
#         while i + j <= len(s) - 1 and s[i] == s[i + j]:
#             j += 1
#         if j >= 7:
#             print("YES")
#             not_dangerous = True
#             break
# if not not_dangerous:
#     print("NO")


# s = list(input())
# ans = ""
# while "+" in s:
#     s.remove("+")
# s.sort()
# for i in range(len(s)):
#     if i != len(s) - 1:
#         ans += s[i] + "+"
#     else:
#         ans += s[i]
#
# print(ans)


# s = list(input())
# capital_letter = s[0]
# s = s[1:]
# ans = ""
# capital_letter = str(capital_letter).capitalize()
# s = [capital_letter] + s
# print(ans.join(s))

# import math
# matrix = []
# for i in range(5):
#     matrix.append(list(map(int, input().split())))
#     if 1 in matrix[i]:
#         (x, y) = i, matrix[i].index(1)
#
# print(str(int(math.fabs(x - 2) + math.fabs(y - 2))))

# input()
# s = list(input())
# ans = []
# counter = 0
# for i in range(len(s) - 1):
#     if s[i] == s[i + 1]:
#         counter += 1
#     else:
#         ans.append(s[i + 1])
#
# print(counter)

# s = set(list(input()))
# print("CHAT WITH HER!" if len(s) % 2 == 0 else "IGNORE HIM!")

# input()
# groups = list(map(int, input().split()))
# group_type = [0, 0, 0, 0]
# ans = 0
# for i in groups:
#     group_type[i - 1] += 1
# ans += group_type[-1]
#
# group_type[-1] = 0
#
# ans += min(group_type[0], group_type[2])
#
# if group_type[0] < group_type[2]:
#     group_type[2] = group_type[2] - group_type[0]
#     group_type[0] = 0
# elif group_type[0] == group_type[2]:
#     group_type[0] = 0
#     group_type[2] = 0
# else:
#     group_type[0] = group_type[0] - group_type[2]
#     group_type[2] = 0
#
# ans += group_type[1] // 2
#
# group_type[1] = group_type[1] % 2
#
# if group_type[0]:
#     taxi = group_type[1] * 2
#     for i in range(group_type[0]):
#         if taxi == 4:
#             ans += 1
#             taxi = 0
#         taxi += 1
#
#     if taxi:
#         ans += 1
# else:
#     ans += group_type[2]
#     if group_type[1]:
#         ans += 1
#
# print(ans)

# n = int(input())
# minimum_capacity = 0
# io_list = []
# io_recorder = 0
# for i in range(n):
#     io_list.append(tuple(map(int, input().split())))
#     if i == 0:
#         minimum_capacity = io_list[0][1]
#     io_recorder -= io_list[i][0]
#     io_recorder += io_list[i][1]
#     if minimum_capacity < io_recorder:
#         minimum_capacity = io_recorder
# print(minimum_capacity)


# n, index = map(int, input().split())
# value_list = list(map(int, input().split()))
# solved = False
# pointer = 0
# for i in range(len(value_list) + 1):
#     if pointer == index - 1:
#         print("YES")
#         solved = True
#         break
#     if pointer < len(value_list):
#         pointer += value_list[pointer]
# if not solved:
#     print("NO")

# import math
#
# n = int(input())
# list1 = list(map(int, input().split()))
# m = int(input())
# list2 = list(map(int, input().split()))
#
# graph = dict()
#
# for i in list1:
#     graph[i] = []
# if n > m:
#     n, m = m, n
#     list1, list2 = list2, list1
#
# for i in list1:
#     for j in list2:
#         if math.fabs(i - j) == 1:
#             graph[i].append(j)
#
# value_list = sorted(list(graph.values()))
# # while graph:
# for i in value_list:
#

# k, n, w = map(int, input().split())
# cost = 0
# for i in range(w):
#     cost += (i + 1) * k
# if cost - n > 0:
#     print(cost - n)
# else:print("0")

# n = int(input())
# xi = 0
# yi = 0
# zi = 0
# for i in range(n):
#     xyz = list(map(int, input().split()))
#     xi += xyz[0]
#     yi += xyz[1]
#     zi += xyz[2]
# if xi == yi == zi == 0:
#     print("YES")
# else:
#     print("NO")

#
# import sys
# s = input()
# print("YES" if "H" in s or "Q" in s or "9" in s else (print("NO"), sys.exit()))

# s = input()
# is_changed = False
# if s.isupper():
#     print(s.lower())
#     is_changed = True
#
# if ord(s[0]) > 96 and (s[1:].isupper() or len(s) == 1):
#     print(s[0].upper() + s[1:].lower())
#     is_changed = True
# if not is_changed:False
#     print(s)


# ans = 0
# for i in range(int(input())):
#     p, q = map(int, input().split())
#     if q - p >= 2:
#         ans += 1
# print(ans)


# n, t = map(int, input().split())
# main_list = list(input())
# for i in range(t):
#     j = 0
#     while j < n:
#         if j != n - 1:
#             if main_list[j] == "B" and main_list[j + 1] == "G":
#                 main_list[j], main_list[j + 1] = main_list[j + 1], main_list[j]
#                 j += 1
#         j += 1
# print("".join(main_list))


# ans = 0
# number = list(map(int, list(input())))
# for i in number:
#     if i == 4 or i == 7:
#         ans += 1
#     if ans > 7:
#         break
# if ans == 7 or ans == 4:
#     print("YES")
# else:
#     print("NO")


# def odd_sum (n):
#     return ((1 + n)/2) * ((n // 2) + 1)
#
#
# def even_sum (n):
#     return ((2 + n) / 2) * (n // 2)
#
#
# n = int(input())
# if n % 2 == 1:
#     # print(int(-odd_sum(n) + even_sum(n - 1)))
#     print(odd_sum(n))
#
# else:
#
#     # print(int(-odd_sum(n - 1) + even_sum(n)))
#     print(even_sum(n))


# s1 = input()
# s2 = input()
# is_solved = False
# if len(s1) != len(s2):
#     is_solved = True
# if not is_solved:
#     for i in range(len(s1)):
#         if s1[i] != s2[len(s1) - 1 - i]:
#             is_solved = True
#             break
# if is_solved:
#     print("NO")
# else:
#     print("YES")

# n = int(input())
# first_time = True
# ans = 0
# income_list = input().split()
# for i in range(n):
#     j = 0
#     while i + j < n - 1:
#         if not (income_list[i + j] < income_list[i + j + 1]):
#             break
#         j += 1
#         # print(j)
#     if j > 0:
#         j += 1
#     if first_time:
#         ans = j
#         first_time = False
#     else:
#         if j > ans:
#             ans = j
#
# print(ans)
#


# n = int(input())
# step_list = input().split()
# is_running = True
# for i in range(n):
#
#
#     while is_running:
#         if temp > step_list[i + j]:
#             is_running = False
#         temp = step_list[i + j]

# import math
# for i in range(1000000000):
#     for j in range(10000000000):
#         print(i, j, i**j, j**i, math.factorial(i), math.factorial(j))

# length = int(input())
# input_string_list = list(map(int, input().split()))
# first_time = True
# temp_list = []
# ans = 0

# temp_list.append(1)
# for i in range(1, length):
#     temp = temp_list[-1]
#     if input_string_list[i] >= input_string_list[i - 1]:
#         temp_list.append(temp + 1)
#     else:
#         temp_list.append(1)

# print(max(temp_list))


# n = int(input())
# main_list = list(map(int, input().split()))
# main_dict = dict()
# ans = ""
# for i in range(1, len(main_list) + 1):
#     main_dict[main_list[i - 1]] = i
# # print(main_dict)
# for i in range(1, n + 1):
#     ans += str(main_dict[i]) + " "
# print(ans[:-1])

# length = int(input())
# input_string_list = list(map(int, input().split()))
# length_list = []
# length_list.append(1)
# for i in range(length - 1):
#     if input_string_list[i] <= input_string_list[i + 1]:
#         length_list[-1] += 1
#     else:
#         length_list.append(1)
# print(max(length_list))

# input_string = input()
# input_string_list = list(input_string)
# input_string_length = len(input_string_list)
# lower_count = 0
# for i in range(input_string_length):
#     if ord(input_string_list[i]) > 96:
#         lower_count += 1
# lower_count = float(lower_count)
# if lower_count >= input_string_length / 2:
#     print(input_string.lower())
# else:
#     print(input_string.upper())


# def odd_sum(n):
#     return (n + 1)*(n // 2 + 1) // 2
#
#
# def even_sum(n):
#     return (n + 2)*(n // 2) // 2
#
#
# n = int(input())
#
# if n % 2 == 0:
#     print(even_sum(n) - odd_sum(n - 1))
# else:
#     print(even_sum(n - 1) - odd_sum(n))

# import sys
# input()
# input_string = input().lower()
# alphabet = "abcdefghijklmnopqrstuvwxyz"
# for i in alphabet:
#     if i not in input_string:
#         print("NO")
#         sys.exit()
# print("YES")


# length1 = int(input())
# set1 = dict(map(lambda x: (x, []), input().split()))
# length2 = int(input())
# set2 = list(map(int, input().split()))
# length_dict = dict()
#
# # for i in range(min(length1, length2)):
#
# for i in set2:
#     if i + 1 in set1:
#         set1[i+1].append(i)
#
#     if i in set1:
#         set1[i].append(i)
#
#     if i - 1 in set1:
#         set1[i - 1].append(i)
#
# for i in set1:
#     length_dict[i] = len(set1[i])


# import sys
# global depth, m, queue
# n, m = map(int, input().split())
# depth = 0
# queue = []
#
#
# def bfs(n):
#     global depth, m, queue
#     if n == m:
#         print(depth)
#         sys.exit()
#     queue.append(n - 1)
#     queue.append(n * 2)
#     depth += 1
#     if n < m:
#         bfs(queue[-1])
#     else:
#         bfs(queue[-2])
#
#
# if n == 4 and m == 6:
#     print("2")
# else:
#     bfs(n)
#
# i = lambda: sorted(list(map(int, input().split())))
# n = i()[0]
# set1 = i()
# m = i()[0]
# set2 = i()

# global main_list, ans, visited
# length = int(input())
# main_list = list(map(int, input().split()))
# ans = []
# visited = [False] * length
# import sys
# sys.setrecursionlimit(1000000000)
#
#
# def dfs(n):
#     global main_list, ans, visited
#     # print(n)
#     if not visited[n]:
#         visited[n] = True
#     else:
#         ans.append(n + 1)
#         return
#     dfs(main_list[n] - 1)
#
#
# for i in range(length):
#     dfs(i)
#     visited = [False] * length
#
# print(*ans, sep=" ")

#
# n, m, k = map(int, input().split())
# if min(m, k) >= n:
#     print("Yes")
# else:
#     print("No")
#


# def filler(matrix):
#     rows_number = len(matrix)
#     columns_number = len(matrix[0])
#     for i in range(rows_number):
#         for j in range(columns_number):
#             if


# n, m = map(int, input().split())

# def f(c, b):
#     ans = 0
#     for i in range(len(b)):
#         if b[i] != c[i]:
#             ans += 1
#     if ans % 2 == 0:
#         return True
#     return False
#
#
# a = input()
# b = input()
# b_length = len(b)
# ans = 0
# for i in range(len(a) - b_length + 1):
#     c = a[i:b_length + i]
#     # print(b, c)
#     if f(c, b):
#         ans += 1
# if len(a) == len(b):
#     if f(a, b):
#         ans += 1
# print(ans)

# def bracket(n):
#     if n >= 0:
#         return int(n)
#     return int(n) - 1
#
#
# def dfs(sum, i):
#     global length, ans_list, victory, main_list
#     num1 = bracket(main_list[i])
#     num2 = num1 + 1
#     if i == length - 1:
#         if sum + num1 == 0:
#             ans_list.insert(0, num1)
#             victory = True
#         if sum + num2 == 0:
#             ans_list.insert(0, num2)
#             victory = True
#         return
#     dfs(sum + num1, i + 1)
#     if victory:
#         ans_list.insert(0, num1)
#         return
#     dfs(sum + num2, i + 1)
#     if victory:
#         ans_list.insert(0, num2)
#         return
#
#
# global length, ans_list, victory, main_list
# length = int(input())
# main_list = []
# ans_list = []
# victory = False
# for i in range(length):
#     main_list.append(float(input()))
#
# dfs(0, 0)
# print(*ans_list[:-1], sep="\n")
# print(ans_list[-1])

# import math
# import sys
#
#
# def queen_cleaner():
#     global matrix, n, queen
#     x = queen[0]
#     y = queen[1]
#     for i in range(n):
#         # print(i, y)
#         matrix[x][i] = 1
#         matrix[i][y] = 1
#     gap = int(max(math.fabs(n - x), math.fabs(n - y)))
#
#     for i in range(gap):
#         if x + 1 < n and y + 1 < n:
#             matrix[x + 1][y + 1] = 1
#         if x + 1 < n and y - 1 < n:
#             matrix[x + 1][y - 1] = 1
#         if x - 1 < n and y + 1 < n:
#             matrix[x - 1][y + 1] = 1
#         if x - 1 < n and y - 1 < n:
#             matrix[x - 1][y - 1] = 1
#
#
# def inputting():
#     ans = list(map(int, input().split()))
#     if len(ans) != 1:
#         for i in range(len(ans)):
#             ans[i] = ans[i] - 1
#     return ans
#
#
# global matrix, n, queen, destination, available_list
#
# n = inputting()[0]
# queen = inputting()[0:2]
# king = inputting()[0:2]
# destination = inputting()[0:2]
#
# matrix = []
# for i in range(n):
#     matrix.append([0 for _ in range(n)])
#
# # for i in matrix:
# #     print(i)
# #     print()
#
# queen_cleaner()
#
# available_list = []
# for i in range(n):
#     for j in range(n):
#         if matrix[i][j] == 0:
#             available_list.append((i, j))
#
# # print(available_list)
#
#
# def dfs(n):
#     global destination, available_list
#     x = n[0]
#     y = n[1]
#     if n == destination:
#         print("YES")
#         sys.exit()
#     for i in available_list:
#         xi = i[0]
#         yi = i[1]
#         if xi == x + 1 and yi == y + 1:
#             dfs((xi, yi))
#         if xi == x + 1 and yi == y:
#             dfs((xi, yi))
#         if xi == x + 1 and yi == y - 1:
#             dfs((xi, yi))
#         if xi == x and yi == y - 1:
#             dfs((xi, yi))
#         if xi == x and yi == y + 1:
#             dfs((xi, yi))
#         if xi == x - 1 and yi == y + 1:
#             dfs((xi, yi))
#         if xi == x - 1 and yi == y:
#             dfs((xi, yi))
#         if xi == x - 1 and yi == y - 1:
#             dfs((xi, yi))
#         return
#
#
# dfs((king[0], king[1]))
# print("NO")


# import sys
#
# sys.setrecursionlimit(1000000000)
#
#
# def dfs(a):
#     global b, ans_list, victory
#     if a > b:
#         return
#     if a == b:
#         victory = True
#         return
#
#     dfs(a * 2)
#     if victory:
#         ans_list.insert(0, a * 2)
#         return
#     dfs(a * 10 + 1)
#     if victory:
#         ans_list.insert(0, a * 10 + 1)
#         return
#
#
# global b, victory, ans_list
# victory = False
# ans_list = []
# a, b = map(int, input().split())
#
# dfs(a)
# if victory:
#     print("YES")
#     ans_list.insert(0, a)
#     print(len(ans_list))
#     print(*ans_list)
# else:
#     print("NO")

#
# class Picture:
#
#     n = 0
#     m = 0
#     matrix = []
#     matrix_dict = dict()
#
#     def __init__(self):
#         self.n = int(input())
#         self.m = int(input())
#         for i in range(self.n):
#             self.matrix.append(list(input().split()))
#
#     def graph_maker(self, matrix, n, m):
#
#         for i in range(n):
#             for j in range(m):
#                 if matrix[i][j] == "*":
#                     if i - 1 >= 0 and matrix[i - 1][j] == "*":
#                         if (i, j) in self.matrix_dict:
#                             self.matrix_dict[(i, j)].append((i - 1, j))
#                         else:
#                             self.matrix_dict[(i, j)] = []
#                             self.matrix_dict[(i, j)].append((i - 1, j))
#                     if j - 1 >= 0 and matrix[i][j - 1] == "*":
#                         if (i, j) in self.matrix_dict:
#                             self.matrix_dict[(i, j)].append((i, j - 1))
#                         else:
#                             self.matrix_dict[(i, j)] = []
#                             self.matrix_dict[(i, j)].append((i, j - 1))
#                     if i + 1 <= m and matrix[i + 1][j] == "*":
#                         if (i, j) in self.matrix_dict:
#                             self.matrix_dict[(i, j)].append((i + 1, j))
#                         else:
#                             self.matrix_dict[(i, j)] = []
#                             self.matrix_dict[(i, j)].append((i + 1, j))
#                     if j + 1 <= n and matrix[i][j + 1] == "*":
#                         if (i, j) in self.matrix_dict:
#                             self.matrix_dict[(i, j)].append((i, j + 1))
#                         else:
#                             self.matrix_dict[(i, j)] = []
#                             self.matrix_dict[(i, j)].append((i, j + 1))
#
#     def deg_4_finder(self, m):
#

# class Graph:
#
#     number_of_nodes = 0
#     graph = dict()
#     graph_degree = [0 for _ in range(number_of_nodes)]
#     root = 0
#
#     def __init__(self):
#
#         self.number_of_nodes = int(input())
#
#         for i in range(self.number_of_nodes - 1):
#             v, u = map(int, input().split())
#             if v in self.graph:
#                 self.graph[v].append(u)
#             else:
#                 self.graph[v] = []
#                 self.graph[v].append(u)
#
#     def root_finder(self):
#
#         # temp_list = self.graph_degree
#         # temp_list.sort()
#         # for i in range
#
#         pass
#
#     def degree_finder(self):
#
#         for i in self.graph:
#             self.graph_degree[i] = len(self.graph[i])
#
#     bfs_depth = 0
#     queue = []
#
#     def bfs_distance_finder(self, v, u):
#
#         if self.queue:
#             if self.queue[0] == u:
#                 return self.bfs_depth
#             del(self.queue[0])
#
#         for i in self.graph[v]:
#             self.queue.append(i)
#             self.bfs_depth += 1
#             self.bfs_distance_finder(i, u)
#             self.bfs_depth -= 1
#


# class Problem:
#
#     def __init__(self):
#         self.n, self.d = map(int, input().split())
#         self.s = input()
#         self.counter = 0
#         self.victory = False
#
#     def solve(self, n):
#         if n == self.n - 1:
#             self.victory = True
#             return
#         break_point = -1
#         self.counter += 1
#         if n + self.d <= self.n - 1:
#             for i in range(n + self.d, n, -1):
#                 if self.s[i] == "1":
#                     break_point = i
#                     break
#         else:
#             for i in range(self.n - 1, n, -1):
#                 if self.s[i] == "1":
#                     break_point = i
#                     break
#
#         if break_point >= 0:
#             self.solve(break_point)
#         else:
#             return
#
#     def output(self):
#         self.solve(0)
#         if self.victory:
#             print(self.counter)
#         else:
#             print("-1")
#
#
# problem = Problem()
# problem.output()

# x = int(input())
# if x % 2 == 0 and x >= 4:
#     print("YES")
# else:
#     print("NO")
#

n = int(input())
ans = 0
for i in range(n):
    number_list = list(map(int, input().split()))
    number_list.sort()
    number_list.reverse()
    number_list = number_list[:2]
    if not (0 in number_list):
        ans += 1

print(ans)


