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.
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;
	private PrintWriter pw;
	private long mod = 1000000000 + 7;

	private StringBuilder ans_sb;
	private int size = 1000005;
	private long[] fact;
	private void soln() {
		long n = nextLong();
		fact = new long[20];
		fact[0] = 1;
		for(long i=1;i<=19;i++) {
			fact[(int)i] = fact[(int)i-1]*i;
		}
		long[] cnt = new long[10];
		while(n!=0) {
			int dig = (int)(n%10);
			n /= 10;
			cnt[dig]++;
		}
		int[] cc = new int[10];
		func(cnt, 0, 1L, cc);
		pw.println(ma);
	}
	private long ma = 0;
	private void func(long[] cnt, int j, long ans, int[] cc) {
		if(j == 10) {
			int tot = 0;
			long mul = 1;
			for(int i=0;i<10;i++) {
				mul *= fact[cc[i]];
				tot += cc[i];
			}
			long aa = fact[tot]/mul;
			if(cc[0] == 0)
				ma += aa;
			else {
				mul /= fact[cc[0]];
				mul *= (fact[cc[0]-1]);
				long aa1 = fact[tot-1]/mul;
				aa -= aa1;
				ma += aa;
			}
			//debug(cc);
			return;
		}
		long n1 = cnt[j];
		if(n1 == 0) {
			func(cnt, j+1, ans, cc);
		}else {
			for(int i=1;i<=n1;i++) {
				cc[j] = i;
				func(cnt, j+1, ans, cc);
			}
		}
	}
	private int contains(int[] arr, int x) {
		for(int i=0;i<arr.length;i++) {
			if(arr[i] == x) {
				return i;
			}
		}
		return -1;
	}
	private class Query implements Comparable<Query>{
		int i, idx, x, y, mul;
		public Query(int a, int b, int c, int d, int m) {
			i = a;
			idx = b;
			x = c;
			mul = m;
			y = d;
		}
		@Override
		public int compareTo(
				Query o)
		{
			return this.i - o.i;
		}
	}
	private long[][] pow(int a, int b, int n) {
		long[][] mat = {{a,0,b},{1L,0,0},{0,1L,0}};
		if(n == 1)
			return mat;
		long[][] res = pow(a,b,n/2);
		res = multiply(res,res);
		if((n&1) != 0)
			res = multiply(mat, res);
		return res;
	}
	private long[][] multiply(long[][] a, long[][] b) {
		long[][] ret = new long[3][3];
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				for(int k=0;k<3;k++)
					ret[i][j] = (ret[i][j] + ((a[i][k]*b[k][j])%mod))%mod;
		return ret;
	}
	private class Node{
		Node left,right;
		int sum;
		public Node(int v) {
			sum=v;
		}
		public Node (Node left,Node right){
			this.left = left;
			this.right = right;
			if (left != null)
				sum = sum + left.sum;
			if (right != null)
				sum = sum + right.sum;
		}
	}
	public Node build(int l,int r) {
		if(l==r)
			return new Node(0);
		int mid=l+((r-l)>>1);
		Node left=build(l,mid);
		Node right=build(mid+1,r);
		return new Node(left,right);
	}
	public int query(int l,int r, Node root) {
		return queryutil(l,r,root,0,size-1);
	}
	public int queryutil(int x,int y,Node node,int l,int r) {
		if(l>y || x>r) 
			return 0;
		if(x <= l && r<=y)
			return node.sum;
		int mid=l+((r-l)>>1);
		return queryutil(x,y,node.left,l,mid) + queryutil(x,y,node.right,mid+1,r);
	}
	public Node newNode(int pos,int val,Node node) {
		return newNodeUtil(pos,val,node,0,size-1);
	}
	public Node newNodeUtil(int pos,int val,Node node,int l, int r) {
		if(l==r)
			return new Node(val);
		int mid=l+((r-l)>>1);
		if(pos<=mid) {
			Node left=newNodeUtil(pos,val,node.left,l,mid);
			return new Node(left,node.right);
		}else {
			Node right=newNodeUtil(pos,val,node.right,mid+1,r);
			return new Node(node.left,right);
		}
	}
	private void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	private long pow(long a, long b, long c) {
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private long gcd(long n, long l) {
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				new Main().solve();
			}
		}, "1", 1 << 26).start();
		//new Main().solve();
	}

	public StringBuilder solve() {
		InputReader(System.in);
		/*
		 * try { InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\in.txt"));
		 * } catch(FileNotFoundException e) {}
		 */
		pw = new PrintWriter(System.out);
		// ans_sb = new StringBuilder();
		soln();

		pw.close();
		// System.out.println(ans_sb);
		return ans_sb;
	}

	public void InputReader(InputStream stream1) {
		stream = stream1;
	}

	private boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private String nextToken() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private int[] nextIntArray(int n) {
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextInt();
		}
		return arr;
	}

	private long[] nextLongArray(int n) {
		long[] arr = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = nextLong();
		}
		return arr;
	}

	private void pArray(int[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private void pArray(long[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private char nextChar() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}