Problem C
Weather Nodes
As part of a research initiative, a series of weather sensors have been put up all around the Mines campus. The idea is to help the local meteorologists more accurately track weather patterns along the front range by reporting precise temperature values at many different locations on the Mines campus.
The day comes when all the devices have been hooked together in a network, and you are tasked with compiling all the data and sending it to the local meteorologists. However, just as you are about to submit the data, something jumps out at you: some of the reported temperature values are way outside of the expected range! Some of the weather sensors must have been set up incorrectly, and are reporting erroneous outliers in the data.
It’s too late to fix the sensors now, so you’ll have to filter the erroneous readings out of the data you already have. Each temperature reading given is a real number representing the temperature in degrees Celsius as read by one of the weather sensors. All of the readings are taken at the same time. You note that all the correct temperature values are always within $10.0$ degrees of the average of all the values. Everything else must be an erroneous reading.
How many of the weather sensors have reported erroneous values?
Input
The first line of the input is an integer, $0 \leq N \leq 1\, 000$ specifying the total number of weather sensors. The remaining $N$ lines each contain a single real number $-10\, 000 \le f \le 10\, 000$ with at most $5$ digits after the decimal point, representing the reading from a single weather sensor.
You are guaranteed that all valid readings will be at most $9.999$ away from the average and that all invalid readings will be at least $10.001$ away from the average.
Output
Print a single integer representing how many weather sensors gave erroneous readings.
Sample Input 1 | Sample Output 1 |
---|---|
5 -20.0 1.0 2.0 3.0 20.0 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
20 26.2 25.0 24.9 32.6 45.2 18.3 21.0 31.1 24.5 21.1 27.0 38.7 29.8 11.4 26.2 23.7 24.1 29.1 9.5 23.3 |
4 |