#K69567. Equilibrium Index

    ID: 33115 Type: Default 1000ms 256MiB

Equilibrium Index

Equilibrium Index

Given an array of integers, an equilibrium index is an index such that the sum of the elements to its left is equal to the sum of the elements to its right. Your task is to find the first equilibrium index in the array. If no such index exists, output -1.

Note: The index is 0-based.

inputFormat

The first line contains an integer n, representing the number of elements in the array. The second line contains n space-separated integers which represent the array elements.

outputFormat

Output a single integer representing the equilibrium index. If no equilibrium index exists, output -1.

## sample
5
1 3 5 2 2
2

</p>