using System;

namespace kv2_z3
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long cnt = 0, a = 1;
            string s = Console.ReadLine();
            int c = 65;
            for(int i = 0; i < n; i++)
            {
                if ((int)s[i] == c) cnt++;
                else if ((int)s[i] > c)
                {
                    a *= cnt;
                    i--;
                    c++;
                    cnt = 0;
                }
                else
                {
                    a *= cnt;
                    c++;
                    cnt = 0;
                }
                if(i == n - 1 && (int)s[i] == c) a *= cnt;
            }
            Console.WriteLine(a % (1000000007));
        }
    }
}