Given an array of integers, return the position of the first element that occurs more than once, or -1 if all elements occur exactly once. For example,
[1, 2, 1]
would return 0.