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 cfROUND;



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by sky on 25 june 2018.
 * www.github.com/aakashjaiswal1
 * aakashjaiswal@hotmail.co.in
 * aakashjaiswal.in@gmail.com
 * people die if they are killed
 */
public class bno {
    public static void main(String[] args) {
        long ans=0;
        in = new FastReader();
        String str=n();
        int[] chelp=new int[10];
        int distinct=0;
        for (int i=0;i<str.length();++i){
            int ele=str.charAt(i)-'0';
            if (chelp[ele]==0)++distinct;
            chelp[ele]++;
        }
        HashMap<Long ,Boolean> hm=new HashMap<>();
        long to=(long)1<<(long)str.length();
        for (int mask=1;mask<to;++mask){
            long c=0;
            long[] cnt=new long[10];
            long mydist=0;
            for (int j=0;j<str.length();++j){
                if ((((1<<j)&mask)!=0)){
                    if (cnt[str.charAt(j)-'0']==0)++mydist;
                    cnt[str.charAt(j)-'0']++;
                    c++;
                }
            }
            if (mydist!=distinct)continue;
            long hv=0;
            long base=1;
            for (int i=0;i<cnt.length;++i){
                hv+=cnt[i]*base;
                base*=16;
            }
            if (hm.containsKey(hv))continue;
            hm.put(hv,true);

            long contri=getFact(c);
            for (int i=0;i<=9;++i){
                if (cnt[i]>1)
                    contri/=getFact(cnt[i]);
            }
            if (cnt[0]>0){
                long minus=getFact(c-1);
                for (int i=1;i<=9;++i){
                    minus/=getFact(cnt[i]);
                }
                if(cnt[0]>2){
                    minus/=getFact((long)(cnt[0]-1));
                }
                contri-=minus;
            }
            ans+=contri;
//            System.out.println("debug");
//            for (int i=0;i<=9;i++){
//                System.out.print(cnt[i]+" ");
//            }
//            System.out.println("=>"+contri);
//
//            System.out.println("debug end");
        }
        System.out.println(ans);
    }
    static long getFact(long no){
        long ret=1;
        for (int i=2;i<=no;++i){
            ret*=i;
        }
        return ret;
    }
    public static long binarySearch(long low, long high) {
        while (high - low > 1) {
            long mid = (high - low)/2 + low;
            //System.out.println(mid);
            if (works(mid)) {
                high = mid;
            } else {
                low = mid;
            }
        }
        return (works(low) ? low : high);
    }
    static private boolean works(long test){
        return true;
    }


    static void reverse(char[] arr ,int i,int j){
        if (i==j)
            return;
        while (i<j){
            char temp=arr[i];
            arr[i]=arr[j];
            arr[j]=temp;
            ++i;
            --j;
        }
    }
    static int[]  takeIntegerArrayInput(int no){
        int[] arr=new int[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static long fast_Multiply(long no , long pow){
        long result=1;
        while (pow>0){
            if ((pow&1)==1){
                result=result*no;
            }
            no=no*no;
            pow>>=1;
        }
        return result;
    }

    static long[]  takeLongArrayInput(int no){
        long[] arr=new long[no];
        for (int i=0;i<no;++i){
            arr[i]=ni();
        }
        return arr;
    }
    static final long MOD = (long)1e9+7;
    static FastReader in;


    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static int[] ia(int N){
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

    static long[] la(int N){
        long[] a = new long[N];
        for(int i = 0; i<N; i++)a[i] = nl();
        return a;
    }

    static long nl(){
        return Long.parseLong(in.next());
    }

    static double nd(){
        return Double.parseDouble(in.next());
    }

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static void println(String[] arr){
        for (int i=0;i<arr.length;++i){
            System.out.println(arr[i]);
        }
    }

}

