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

namespace ConsoleApplication68
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            char[] z = new char[n];
            int[] broj = new int[26];
            char[] azbuka = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
            int j=0;
            for (int i = 0; i < n; i++)
            {
               z[i] = (char)Console.Read();
               if (z[i] == azbuka[j]) broj[j]++;
               if (j < 25)
               {
                   if (azbuka[j + 1] == z[i]) 
                   {
                       j++; 
                       broj[j]++;
                   }
               }
               
            }
            Console.ReadLine();
            long koliko_puta=1;
            for (int i = 0; i < 26; i++)
            {
                koliko_puta *= broj[i];
            }
            Console.WriteLine(koliko_puta%(Math.Pow(10,9)+7));
        }
    }
}