Alice n candy ith candy type candyTypei Alice notice start gain weight visit doctorthe doctor advise Alice eat n 2 candy n Alice like candy want eat maximum number different type candy follow doctor advicegiven integer array candytype length n return maximum number different type candy eat eat n 2 Example 1input candyType 112233output 3explanation Alice eat 6 2 3 candy since 3 type eat typeexample 2input candytype 1123output 2explanation Alice eat 4 2 2 candy whether eat type 12 13 23 eat 2 different typesExample 3input candyType 6666output 1explanation Alice eat 4 2 2 candy even eat 2 candy 1 type Constraintsn candytypelength2 n 104n even105 candyTypei 105