The answer is 31321. But I am not able to understand the method.
https://www.quora.com/How-many-6-digit-numbers-can-be-formed-from-1-2-2-3-3-3-4-4-4-4-5-5-5-5-5-6-6-6-6-6-6
Gatecse