Company: Infosys SP
Difficulty: medium
Equalize Buildings\' Heights You are given an array Arr of size N where each element Arr i represents the height of a building. You can increase the height of exactly one building in one year, and you have to make all buildings equal using the following strategy: If the year is odd , the height of the building will increase by 1 . If the year is even , the height of the building will increase by 2 . You can choose no building in any year, and none of the buildings\' height will increase. Find the minimum number of years to make all the buildings the same height. Since the answer can be large, return it modulo 10 9 + 7 . Input Format The first line contains an integer N , denoting the number of elements in Arr . Each of the next N lines contains an integer Arr[i] , denoting the height of each building. Output Format Print the minimum number of years required to make all the buildings the same height, modulo 10 9 + 7 . Constraints 1 ≤ N ≤ 10 5 1 ≤ Arr[i] ≤ 10 9 Examples Input: 2 1 3 Outp