Solution for Distinct