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;
            for(int i = 0; i < n; i++)
            {
                if (s[i] == a[m]&&m<=25) m++;
                else r = r * (m + 1);
            }
            r = r % 1000000007;
            Console.WriteLine(r.ToString());




        }
    }
}