using System;

namespace slova
{
    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long z = 1;
            int ind = 0;
            string s = Console.ReadLine();
            if (n <= 26)
            {
                Console.WriteLine(0);
            }
            else if (n == 27)
            {
                Console.WriteLine(1);
            }
            else
            {
                for (int i = 65; i <= 90; i++)
                {
                    int br = 0;
                    char c = (char)i;
                    char c2 = (char)(i + 1);
                    for (int j = ind; j < n; j++)
                    {
                        if (s[j] == c)
                        {
                            br++;
                        }



                        if (c != 'Z') { if (s[j + 1] == c2) { ind = j; break; } }

                    }
                    if (br > 1) z *= br;
                }
                Console.WriteLine(z);
            }
        }
    }
}