Find the occurence of each number from array in O(n) ?