Example: array length = 3 input array={2,2,2} return -1 as only (2) same value exist if input array ={2,1,2} return 1