Find duplicate elements in the array with 4KB memory only