import java.util.Scanner;


public class Tezdhxjtj {

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        char k[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
        int x=Integer.parseInt(in.nextLine());
        if(x<=26){
        System.out.println(0);
        }
        char k1[]=new char[x];
        String kk = in.nextLine();
        k1=kk.toCharArray();
        int o=0;
        int n=0;
        int t=1;
        for(int i=0;i<26;i++){
            while(k[i]!=k1[o]){
                o++;
                n++;
                if(k[i]==k1[o]){
            t=t*n;
            }
            }
            n=0;
        }
        System.out.println(t);

    }
    
}