#C5851. Find First Element Above Average
Find First Element Above Average
Find First Element Above Average
Given a list of numbers, your task is to find the first element that is greater than the average of all the numbers in the list. The average \(A\) is computed as \(A = \frac{a_1 + a_2 + \cdots + a_n}{n}\), where \(n\) is the number of elements. If no element is greater than the average, output -1.
The input will be provided via STDIN and the result should be printed to STDOUT.
inputFormat
The first line contains an integer n indicating the number of elements in the list. If n is 0, the list is considered empty. The second line (if n > 0) contains n numbers separated by spaces.
outputFormat
Output a single number which is the first element in the list that is greater than the average of the list. If no such element exists, output -1.
## sample5
1 2 3 4 5
4