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

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