#C7107. Array Statistics

    ID: 50942 Type: Default 1000ms 256MiB

Array Statistics

Array Statistics

You are given an array of integers. Your task is to compute the following statistics:

  • The minimum element.
  • The maximum element.
  • The mean, defined as \(\mu = \frac{1}{n}\sum_{i=1}^{n}a_i\).
  • The median. For an odd number of elements, the median is the middle element when the array is sorted. For an even number of elements, it is the average of the two middle elements.

Print the four values (minimum, maximum, mean, median) separated by a single space. The mean and median should be printed as floating point numbers (e.g. 5.0).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains a single integer \(n\), the number of elements in the array.
  2. The second line contains \(n\) space-separated integers.

outputFormat

Output to standard output (stdout) a single line containing four values: the minimum element, maximum element, mean, and median, separated by a single space.

## sample
1
4
4 4 4.0 4.0