This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.

In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number n.

In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could "see" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.

Given n, determine the total number of possible bus number variants.

Input

The first line contains one integer n (1 ≤ n ≤ 10^{18}) — the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with 0.

Output

Output a single integer — the amount of possible variants of the real bus number.

Examples

Input

97


Output

2


Input

2028


Output

13

Note

In the first sample, only variants 97 and 79 are possible.

In the second sample, the variants (in the increasing order) are the following: 208, 280, 802, 820, 2028, 2082, 2208, 2280, 2802, 2820, 8022, 8202, 8220.
//package ;
import java.io.*;
import java.util.*;

public class E
{
	public static long fac(String n)
	{
		n=sortString(n);
		if(hs.contains(n))
			return 0;
		hs.add(n);
		long metkarar=1;int t=1;char c=n.charAt(0);int z=0;long metwnz=1;
		if(c=='0')
			z++;
		for(int i=1;i<n.length();i++)
		{
			if(n.charAt(i)=='0')
				z++;
			if(n.charAt(i)==c)
				t++;
			else
			{
				if(c!='0')
					metwnz*=fac[t];
				metkarar*=fac[t];
				t=1;
				c=n.charAt(i);
			}
		}
		if(b[0]>1)
			metwnz*=fac[b[0]-1];
		if(n.length()>1 && n.charAt(n.length()-1)==n.charAt(n.length()-2))
		{	
			metwnz*=fac[t];
			metkarar*=fac[t];
		}
		if(n.contains("0"))
		{	
//			System.out.println(n+" "+((fac[n.length()]/metkarar)-(fac[n.length()-1]/metwnz)));
			return ((fac[n.length()]/metkarar)-(fac[n.length()-1]/metwnz));
		}
//		System.out.println(n+" "+(fac[n.length()])/metkarar);
		return (fac[n.length()])/metkarar;
	}
	public static void sol(String n)
	{
		for(int i=0;i<10;i++)
		{
			if(a[i]>1)
			{
				b[i]++;
				a[i]--;
				ans+=fac(n+i);
				sol(n+i);
				b[i]--;
				a[i]++;
			}
		}
	}
	static HashSet<String>hs=new HashSet<>();
	static int[]a,b;static long[]fac;static long ans;static String sans;
	public static void main(String[] args) throws IOException 
	{
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.nextLine();
		a=new int[10];
		b=new int[10];
		fac=new long[20];
		fac[0]=1;
		for(int i=1;i<20;i++)
			fac[i]=i*fac[i-1];
		int distinct=0;
		String number="";
		for(int i=0;i<s.length();i++)
		{
			int j=Integer.parseInt(s.charAt(i)+"");
			a[j]++;
			if(b[j]==0)
			{	b[j]=1;
				number+=j;
			}
			if(a[j]==1)
				distinct++;
		}
		number=sortString(number);
//		System.out.println(number);
		ans=fac(number);
		sol(number);
		System.out.println(ans);
		pw.close();    
	}
	 public static String sortString(String inputString)
	    {
//		 29340299842560
//		 29340299842560
//		 26077479790320
//		 31066620068800
	        // convert input string to char array
	        char tempArray[] = inputString.toCharArray();
	         
	        // sort tempArray
	        Arrays.sort(tempArray);
	         
	        // return new sorted string
	        return new String(tempArray);
	    }
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;
		
		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}
		
		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		
		long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		
		double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		String nextLine() throws IOException {
			return br.readLine();
		}
		boolean hasnext() throws IOException{
			return br.ready();
		}
		
	}
}
