All problems

Mean Absolute Deviation

mediumPythonNumPyStatistics

Riverbend Supply's forecasting team is unhappy with the standard deviation as a headline for how scattered a set of figures is. Squaring makes one freak value dominate, and the team would rather report a figure a non-statistician can read: the typical distance from the centre, in the original units. The measure they publish is the mean absolute deviation — the average of how far each figure lies from the set's centre, with direction ignored. Their handbook fixes both halves of that: the centre is the arithmetic mean, and the distances are combined by averaging them.

Task: Print the mean absolute deviation of the figures.

Input

The first line holds a single integer n, the number of figures. Each of the next n lines holds one figure, which may carry decimals.

Output

One line holding the mean absolute deviation with exactly two digits after the decimal point. A set in which every figure is identical prints as 0.00.

Example:

Input:
4
2
4
4
6

Output:
1.00

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…