If there are only 3 different kinds of elements in an array.
We can sort the array with O(n) algorithm.