All problems

Charting Gains and Losses

mediumPythonMatplotlibBar Chart

Alderwood Supply charts the month-on-month change in headcount, and some months are losses. On the chart a loss simply hangs below the zero line, which is why the picture needs no special handling. The commentary beside it does need care: it opens by saying how many months went backwards. A month with no change at all did not go backwards — zero is neither a loss nor a gain, and it is not counted.

Task: Print how many months recorded a loss.

Input

The first line holds an integer n, the number of months. Each of the next n lines holds a month name and that month's change, separated by a single space. A change may be negative, and a name contains no spaces.

Output

One line holding the count of months whose change is below zero, as a plain integer.

Example:

Input:
4
Jan 10
Feb -5
Mar 8
Apr -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…