using System;

namespace ConsoleApp32
{
    class Program
    {
        static int VratiBrojZaSlovo(char c)
        {
            switch (c)
            {
                case 'A': return 0;
                case 'B': return 1;
                case 'C': return 2;
                case 'D': return 3;
                case 'E': return 4;
                case 'F': return 5;
                case 'G': return 6;
                case 'H': return 7;
                case 'I': return 8;
                case 'J': return 9;
                case 'K': return 10;
                case 'L': return 11;
                case 'M': return 12;
                case 'N': return 13;
                case 'O': return 14;
                case 'P': return 15;
                case 'Q': return 16;
                case 'R': return 17;
                case 'S': return 18;
                case 'T': return 19;
                case 'U': return 20;
                case 'V': return 21;
                case 'W': return 22;
                case 'X': return 23;
                case 'Y': return 24;
                case 'Z': return 25;
            }
            return 0;
        }
        static void Main(string[] args)
        {
            long n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            long[] c = new long[n]; long proizvod = 1;
            long[] pov = new long[26]; long br = 0;
            for (int i = 0; i < 26; i++)
            {
                pov[i] = 1;
            }
            foreach (char ch in s)
            {
                c[br] = VratiBrojZaSlovo(ch);
                br++;
            }
            for (long i = 1; i < br; i++)
            {
                if (c[i] == c[i - 1])
                {
                    pov[c[i]]++;
                }
            }
            for (int i = 0; i < 26; i++)
            {
                proizvod *= pov[i];
            }
            if (proizvod == 1)
            {
                Console.WriteLine(0);
            }
            else
            Console.WriteLine(proizvod%1000000007);

        }
    }
}