#K76. Array Sum and Median Processing

    ID: 34544 Type: Default 1000ms 256MiB

Array Sum and Median Processing

Array Sum and Median Processing

You are given an array of integers. Your task is to perform the following operations:

  1. Compute the sum of all the elements in the original array.
  2. Sort the array in non-decreasing order and remove any duplicate elements.
  3. Determine the median of the resulting array. The median is defined as follows: if the number of elements is odd, it is the middle element; if even, it is the average of the two middle elements in \(\LaTeX\): \(\frac{a_{\frac{n}{2}} + a_{\frac{n}{2}+1}}{2}\), ensuring if the result is an integer, print it without a decimal point.

The input will be provided via standard input and the expected output should be printed to standard output. The first line contains an integer \(n\) representing the count of numbers in the array, followed by a line with \(n\) space-separated integers.

inputFormat

The first line of input contains an integer \(n\) (the number of elements in the array). The second line contains \(n\) space-separated integers.

outputFormat

Output two lines: the first line is the sum of the original array. The second line is the median of the modified (sorted and duplicate removed) array. If the median is an integer, it should be printed as an integer; otherwise, print the decimal value.

## sample
6
1 3 3 6 7 8
28

6

</p>