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.
"""
Module's built for competitive programming
Reminders:

Before you solve a problem, write name_problemnumber.
"""
import math
vowel_list = ['a','e','i','o','u','y']


def watermelon_4a():
    """
    Fun little problem, it does have one
    tricky use case with the num though
    """
    num = int(input())
    if num % 2 == 0:
        if num == 2:
            print("NO")
        else:
            print("YES")
    else:
        print("NO")
    return


def theatre_square_1a():
    """
    .... So I figured out that if I just divide the side by the
    flagstone length, then I could solve the problem probably,
    by just doing that. lmfao. That's it. I fully understand the problem
    now. It's just a matter of drawing it on a piece of paper and
    figuring out the solution that way.
    """
    input_list = read_list(int, input())
    length = input_list[0]
    width = input_list[1]
    flagstone = input_list[2]

    ans_0 = int(math.ceil(length/flagstone))
    ans_1 = int(math.ceil(width/flagstone))
    print(ans_0 * ans_1)
    return


def way_to_long_words_71a():
    """
    Straight forward implementation, if it's less than of equal to
    10, then we print the word. Else we take the first letter and the last
    letter and glue it onto the total count minus 2.
    """
    cases = read_int()
    for counter in range(cases):
        word = input()
        word_len = len(word)
        if(word_len <= 10):
            print(word)
        else:
            print(word[0] + str(word_len - 2) + word[word_len - 1])
    return


def next_round_158a():
    """
    Trickiest part of this problem was the multiple use cases. I'm
    sure that now that I finished the problem, I can make multiple
    changes to make it more efficient. 
    """
    read_in = read_list(int, input())
    participant_scores = read_list(int, input())
    total_participants = read_in[0]
    finish_place = read_in[1]
    counter = 0

    if total_participants == 1:
        if participant_scores[0] == 0:
            print(0)
        else:
            print(1)
        return
    else:
        if(participant_scores[finish_place - 1] == 0):
            for participant in participant_scores:
                if(participant != 0):
                    counter+=1
        else:
            for participant in participant_scores:
                if(participant >= participant_scores[finish_place-1]):
                    counter += 1
    print(counter)
    return


def string_task_118a():
    """
    Very straight forward replacement
    """
    string = input()
    string = string.lower().\
             replace("a","").\
             replace("e","").\
             replace("i","").\
             replace("o","").\
             replace("u","").\
             replace("y","")

    final_str = ""
    for letter in string:
        final_str += "."
        final_str += letter

    print(final_str)
    return


def domino_piling_50a():
    """
    Initial thought: It's very similar to theatre square 1a
    """
    dimensions = read_list(int, input())
    length = dimensions[0]
    width = dimensions[1]

    print(int(math.floor(length * width / 2)))
    return


def team_282a():
    """

    """
    problems_implemented = 0
    total_problems = read_int()
    for problem in range(total_problems):
        decisions = read_list(int)
        if sum(decisions) >= 2:
            problems_implemented += 1

    print(problems_implemented)
    return


def read_list(type_in):
    """
        Read input for code-forces problems
    """
    return list(map(type_in, input().split()))


def read_int():
    """
        Read the integer that's usually at the start of the problem
    """
    return int(input())


def main():
    team_282a()
    return


if __name__ == "__main__":
    main()
