All problems

A Diverging Bar Plot (Positive vs Negative)

mediumPythonSeabornDiverging Bars

Tidewater Foods reports each category's change against last quarter, so the numbers run both above and below zero. The chart colours growth and shrinkage differently, since a wall of one colour reads as "all fine" at a glance whichever way the bars point. The headline under it is a plain count of the categories that went backwards.

Task: Print how many categories fell.

Input

The first line holds one integer n, the number of categories. Each of the next n lines holds a category name and its change, separated by a single space. The change may be negative, and names contain no spaces.

Output

One line holding a single whole number: how many categories have a change below zero. A change of exactly zero has not fallen and is not counted. Print 0 when nothing fell.

Example:

Input:
4
A 5
B -3
C -1
D 2

Output:
2

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…