```
/**
* @param {number[]} candies
* @return {number}
*/
var distributeCandies = function(candies) {
let hashTable = {};
for (let i = 0; i < candies.length; i++)
hashTable[candies[i]] = 0;
let len = parseInt(candies.length / 2);
let keysCount = 0;
for (let key in hashTable)
keysCount++;
if (keysCount >= len)
return len;
else
return keysCount;
};
```