```
public class Solution {
public int distributeCandies(int[] candies) {
int len = candies.length;
int max = (int)Arrays.stream(candies).distinct().count();
return Math.min(max, len/2);
}
}
```

This solution utilize stream() and distinct() method