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

namespace zaddrugi
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            char[] s = Console.ReadLine().ToCharArray();
            char[] a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
            int r = 1;
            int m = 0;
            int k = 1;
            for(int i = 0; i < n-1; i++)
            {
                if (s[i] == a[m]&&m<26) m++;
                else
                {
                    r = r * k;
                    k++;
                }
            }
            r = r % 1000000007;
            if (n == 26) r = 0;
            if (n == 27) r = 1;
            Console.WriteLine(r.ToString());




        }
    }
}