You are given a number N.
Create a set S containing the digits of the number N.(set has only 1 occurence of each element).Using this set create a number X.
Choose a subsequence of indices from the number N and create a number Y.
You need to tell the number of distinct numbers Y that can be created such that X and Y are permutation of each other.
Note: X and Y may have leading 0's.
Constraints
1≤T≤100
1≤LengthOf|N|≤100
Each character is digit (i.e '0' to '9').
Input Format
First line contains T (the number of testcases).
Each testcase contains a Number N
Output Format
In each line print the number of distinct possible values of Y.
For testcase 1, the distinct possible Y's are 01.
For testcase 2, the distinct possible Y's are 01 and 10.