The Two-Sigma Alarm
Northgate Hosting pages an engineer when a request takes an unusual amount of time. Unusual means far from what this batch of requests normally looks like, in either direction — a reply that comes back suspiciously fast matters as much as a slow one, since it usually means a broken cache served an empty answer. The alarm line sits two population standard deviations away from the batch mean, and a latency has to be strictly further out than that to count.
Task: Print how many latencies in the batch would raise an alarm.
Input
The first line holds one integer n, how many latencies follow. Each of the next n lines holds one latency as a plain number. A batch may contain no unusual latencies at all, and it may contain more than one.
Output
One line holding a single whole number: how many latencies raise an alarm. Print 0 when nothing qualifies.
Example:
Input:
8
10
11
9
10
12
10
11
40
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