All problems

Filtering Before Charting

mediumPythonSeabornDataFrame Filtering

Fernbrook Analytics keeps closed accounts in the same table as live ones, flagged rather than deleted, because the history is needed for billing. Panels are supposed to show live accounts only. Charts have shipped with dead accounts in them more than once, so the tool now prints how many records actually survived the filter, and a suspiciously round or suspiciously large number gets the panel rejected.

Task: Print how many records are live.

Input

The first line holds one integer n, the number of records. Each of the next n lines holds two measurements and a flag, separated by single spaces. All three are whole numbers, and the flag is 1 for a live account or 0 for a closed one.

Output

One line holding a single whole number: how many records carry the live flag. Print 0 if none do.

Example:

Input:
4
1 1 1
2 2 0
3 3 1
4 4 1

Output:
3

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…