using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace treci
{
    class Program
    {
        static void Main(string[] args)
        {
            bool bul = false;
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int[] br = new int[n];
            long  brr = 1;
            int brojac = 0;
            for (int i = 0; i <= 27; i++)
            {
                   br[i]=1;
            }
            for (char c = 'A'; c <= 'Z'; c++)
            {
                int i = 0;
                i = c - 64;
                int m = s.IndexOf(c);
                bul = true;
                while (bul == true)
                {
                    if (m != s.Length-1)
                    {
                        if (s[m] == s[m + 1])
                        {
                            br[i]++;
                            bul = true;
                            m++;
                        }
                        else
                        {
                            bul = false;
                            brojac++;
                        }
                    }
                    else
                    {
                        bul = false;
                        brojac++;
                    }

                }
            }
            for (int i = 1; i <= 26; i++)
            {
                if(br[i]!=0)
                    brr *= br[i];
            }
            brr %= 1000000007;
            Console.WriteLine(brr);
        }
    }
}