Equivalence Class (I.S.I. Tomato subjective 60)

Problem: Consider the set S of all integers between and including 1000 and 99999. Call two integers x and y in S to be in the same equivalence class if the digits appearing in x and y are the same. For example, if x = 1010, y = 1000 and z = 1201, then x and y are in the same equivalence class, but y and z are not. Find the number of distinct equivalence classes that can be formed out of S.
Solution: Any set of distinct digits with maximum order 5 is a equivalence class that can be formed out of S except {0}.
Number of such sets is
= \({\dbinom {10}{1}} \) + \({\dbinom {10}{2}} \) + \({\dbinom {10}{3}} \) + \({\dbinom {10}{4}} \) + \({\dbinom {10}{5}} \) -1
= 10 + 45 + 120 + 210 + 252 -1
= 636