using System;

namespace ConsoleApp66
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            if (n <= 26) Console.WriteLine(0);
            else if (n == 27)
            {
                bool p = true;
                for(int i = 0; i < n-1; i++)
                {
                    if (s[i] > s[i + 1]) p = false; 
                }
                if (p == false) Console.WriteLine(1);
                else Console.WriteLine(2);
            }
            else {
                int p = 1;
                
                int i = 0;
                while (i < n - 1) {
                    int br = 1;
                    while (i+1<n && s[i] == s[i + 1])
                    {
                        br++;
                        i++;
                    }
                    p *= br;

                    p %= (1000000000 + 7);
                    i++;

                }
                Console.WriteLine(p);
            }
        }
    }
}