Array Reduction method example

Hi,
Have few doubts on how to write constraint using array reduction methods.

Assume the array size is 10.
1.Write a constraint to generate unique values in an array using array reduction method.
tried below two ways, buts seeing constraint solver issue.
i. arr.sum() with(int’(arr[item.index] != arr[item.index-1]));
ii. arr.sum() with(int’(item.index>0 → arr[item.index] != arr[item.index-1]));
2. Out of 10 elements only 3 elements should be same and remaining 7 elements should be unique.

Thanks,