Customizing Outlier Marker Appearance
Ironbark Manufacturing prints its box charts small for a wall board, and the dots marking unusual measurements were being lost, so they are now drawn larger. Making a marker bigger changes nothing about which measurements are marked, and to prove it the wall board carries the count in text, worked out from the quarter-points of the measurements: the value a quarter of the way up the sorted list and the value three quarters of the way up.
Task: Print how many measurements are marked as unusual.
Input
The first line holds one integer n, the number of measurements. Each of the next n lines holds one measurement, a number on its own. Measurements may be negative.
Output
One line holding a single whole number. Let Q1 be the lower quarter-point and Q3 the upper one, both taken by sliding evenly between the two neighbouring measurements when the quarter-point falls between them. A measurement is marked when it is below Q1 - 1.5 * (Q3 - Q1) or above Q3 + 1.5 * (Q3 - Q1). Count both sides, and print 0 when nothing is marked.
Example:
Input:
5
10
11
12
13
1000
Output:
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