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

namespace ConsoleApplication70
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            char[] a = new char[n];
            long b = 1;
            int d = 1;
            int i = 0;
            foreach (char c in s)
            {
                a[i] = c;
                i++;
            }
            if (n <= 26)
            {
                Console.WriteLine(0);
            }
            else
            {
                char p = a[0];
                bool t = true;
                for (i = 1; i < n; i++)
                {
                    if (a[i] > p) t = true;
                    if (a[i] < p) t = false;
                    if (a[i] == p && t)
                    {
                        d++;
                    }
                    else
                    {
                        b *= d;
                        d = 1;
                        p = a[i];
                    }
                }
                if (a[n - 1] == p)
                {
                    b *= d;
                }
                Console.WriteLine(b % 1000000007);
            }
            Console.ReadKey();
        }
    }
}