Optimize find number with even occurrences in array