All problems

Counting Points in Each Quadrant

mediumPythonMatplotlibScatter Plot

Meridian Insight charts a retailer's products against the same week last year: across is the change in price, up is the change in units sold. Two faint lines are drawn through zero, cutting the picture into four corners, and each corner tells the buying team something different — dearer and selling more, cheaper and selling more, cheaper and selling less, dearer and selling less. The four tallies go underneath the picture.

Task: Print how many products fall in each corner, in this fixed order: first dearer and selling more (both numbers positive), second cheaper and selling more (across negative, up positive), third cheaper and selling less (both negative), fourth dearer and selling less (across positive, up negative).

Input

The first line holds an integer n, the number of products. Each of the next n lines holds two numbers separated by a single space, and neither is ever exactly zero.

Output

One line holding the four tallies separated by single spaces, in the order above. An empty corner prints as 0.

Example:

Input:
4
1 1
-1 1
-1 -1
1 -1

Output:
1 1 1 1

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…