import java.util.Scanner;
public class Tezdhxjtj {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int x=Integer.parseInt(in.nextLine());
        if(x<=26){
        System.out.println(0);
        }
        char k[]=new char[x];
        String kk = in.nextLine();
        k=kk.toCharArray();
        int n=1;
        int t=1;
        for(int i=0;i<x-1;i++){
            while(k[i]==k[i+1]){
                n++;
                i++;
                if(i==x-1){
                    break;
                }
            }
            t=t*n;
            n=1;
        }
        System.out.println(t);
    }
}