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

namespace Slova
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            char[] alfabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ ".ToCharArray();
            string unos = Console.ReadLine();
            bool[] pravilni = new bool[N];
            if (unos[0] == 'A')
                pravilni[0] = true;
            if (unos[N - 1] == 'Z')
                pravilni[N - 1] = true;
            for (int i = 1; i < N - 1; i++)
            {
                if ((unos.Substring(0, (i)).Contains(alfabet[Array.IndexOf(alfabet, unos[i]) - 1]) || unos[i] == 'A') && ((unos.Substring((i + 1), N - 1 - i).Contains(alfabet[Array.IndexOf(alfabet, unos[i]) + 1]) || unos[i] == 'Z')))
                    pravilni[i] = true;
            }
            List<char> validni = new List<char>();
            for (int i = 0; i < N; i++)
            {
                if (pravilni[i])
                    validni.Add(unos[i]);
            }
            char[] niz = validni.ToArray();
            double proizvod = 1;
            for (int i = 1; i < alfabet.Length - 1; i++)
            {
                proizvod *= Array.FindAll<char>(niz, x => x == alfabet[i]).Length % (Math.Pow(10,9)+7);
            }
            Console.WriteLine((proizvod % (Math.Pow(10, 9) + 7)).ToString());
            Console.ReadKey();
        }
    }
}