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

namespace takmicenje3._2
{
    class Program
    {
        static void Main(string[] args)
        {
            int b = 0, c = 0; 
            UInt64 suma=1;
            int n=int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            s.ToUpper();
            int[] niz = new int[91];
            if (n < 27)
                suma = 0;
            else
            {
                for (int i = 0; i < n; i++)
                {
                    b = Convert.ToInt32(s[i]);
                    if (i < n - 1)
                    {
                        c = Convert.ToInt32(s[i + 1]);
                        if (b > c)
                        {
                            niz[c]--;
                        }
                    }
                    niz[b]++;
                }              
                for (int i = 65; i < 91; i++)
                {
                    if (niz[i] >= 2)
                        suma *= Convert.ToUInt64(niz[i]);
                    while (suma > 1000000007)
                        suma -= 1000000007;
                }
            }
            Console.WriteLine(suma);
            Console.ReadLine();
        }
    }
}