```
public class Solution
{
public int DistributeCandies(int[] candies)
{
var candyAndCount = new Dictionary<int, int>();
foreach(var candy in candies)
{
if (!candyAndCount.ContainsKey(candy)) candyAndCount[candy] = 0;
candyAndCount[candy]++;
}
var numberOfKinds = candyAndCount.Count;
var totalForSister = candies.Length / 2;
return Math.Min(totalForSister, numberOfKinds);
}
}
```