The celebrated general Archibald Waving took charge of the second army in the occidental front.
After losing the first army, Waving has become obsessed with effective organization of the army.
As a part of this endeavor he has assigned numbers to each of his soldiers. He has also devised a rule
which allows two soldiers to work together if and only if the numbers assigned to the soldiers are
neighbouring numbers. Two numbers x and y are neighbouring numbers if there exists a permutation of digits
of x and a permutation of digits of y such that they are equal if we ignore the
leading zeros in the permutations.
For example, the numbers 40020 and 204 are neighboring. To see this, permute the digits of 40020 to achieve
00042 and the digits of 204 to achieve 042. If you ignore the leading zeros, both numbers become equal to 42,
so they are neighboring.
You are given a int numbers representing soldiers' numbers. Waving needs
to pick two soldiers to send a telegram. He would like to know how many different pairs of soldiers are
there who can work together to accomplish the task. Help Waving by returning the number of pairs of
neighbouring numbers in the int numbers.