using System;

namespace DrugiKrug2020Slova
{
    class Program
    {
        static void Main(string[] args)
        {
            long br = 1;
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            long mali = 1;
            if (n! <= 26)
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (s[i] == s[i + 1])
                    {
                        mali++;
                    }
                    else
                    {
                        br *= mali;
                        mali = 1;
                    }
                }
                if (mali > 1) br *= mali;
                Console.WriteLine(br % (Math.Pow(10, 9) + 7));
            }
            else
            {
                Console.WriteLine("0");
            }
           
        }
    }
}