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

namespace petilja_3feladat
{
    class Program
    {
        static void Main(string[] args)
        {
            string Nstring = Console.ReadLine();
            int n = Convert.ToInt32(Nstring);
            string abc = Console.ReadLine();
            char[] sorrend = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
            int[] db = new int[26];
            int visz = 0;
            
            for (int i = 0; i < n; i++)
            {
                try
                {
                    char x1 = abc[i];
                    char x2 = abc[i + 1];
                    if (x1 == sorrend[visz])
                    {
                        if (x1 != x2)
                        {
                            if (x2 != sorrend[visz + 1])
                            {
                                string abc2 = null;
                                for (int j = 0; j < abc.Length; j++)
                                {
                                    if(j!=i+1)
                                    abc2 += abc[j].ToString();
                                }
                                abc = abc2;
                            }
                        }
                    }
                    else
                    {
                        visz++;
                        i--;
                    }
                }
                catch (Exception)
                {
                    //Console.Write("E");
                }
                
            }

            //Console.WriteLine(abc);

            for (int i = 0; i < 26; i++)
            {
                string[] xTomb = abc.Split(sorrend[i]);
                string x = null;
                for(int j = 0; j != xTomb.Length; j++)
                {
                    x += xTomb[j];
                }
                db[i] = abc.Length - x.Length;
            }

            double exit = 1;
            for (int i = 0; i < 26; i++)
            {
                exit *= db[i];
            }

            Console.WriteLine(exit % 1000000007);

        }


    }
}