using System;

namespace slova
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine()+" ";
            double komb = 1;

            double d = Math.Pow(10, 9) + 7;

            if (n <= 26) komb = 0;
            else
            {
                double[] br = new double[26];
                for (int i = 0; i < n; i++)
                {
                    br[((int)s[i]) - 65]++;
                    if (br[((int)s[i]) - 65] == 0) { komb = 0; break; }
                    if (i != 0 && s[i] < s[i - 1] && s[i + 1] != s[i - 1])
                        br[((int)s[i]) - 65]--;

                }
                if (komb != 0)
                {

                    for (int i = 0; i < 26; i++)
                    {
                        komb *= br[i];

                    }
                }
            }
            Console.WriteLine(komb % d);

        }
    }
}