All problems

Choosing How Many Bins

easyPythonMatplotlibHistogram

Bramley Foods asks every customer for a rating from 0 to 9. Ashgrove Analytics draws those ratings as a ten-band chart, but the board reads only two figures off it: how many people picked the very bottom of the scale, and how many picked the very top. Those two figures are printed as text under the picture, and only the text is graded.

Task: Print how many ratings are exactly 0, followed by how many are exactly 9.

Input

The first line holds an integer n, the number of ratings. Each of the next n lines holds one rating as a whole number. Most sit on the 0-to-9 scale, but the collection form does not enforce it, so the occasional -1 or 12 comes through; a rating off the end of the scale is neither the bottom of it nor the top, and belongs in neither figure. The final line holds how many bands the picture should draw; it is always 10, and it has no effect on the two counts.

Output

Two lines. The first holds the count of 0s, the second the count of 9s, in that order — not both on one line. A rating nobody chose is reported as 0.

Example:

Input:
5
0
0
9
5
0
10

Output:
3
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…