using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;


namespace ConsoleApplication2
{

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            char[] c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
            int[] a = new int[26];
            int d = 0;
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (d >25)
                    d = 0;
                if (s[i] == c[d])
                {
                    a[d]++;
                    if (s[i + 1] != s[i])
                        d++;
                }
                if (d > 25)
                    d = 25;
                if (i == s.Length - 2)
                {
                    if (c[d] == s[s.Length - 1])
                        a[d]++;
                }
            }
            long zb = 1;
            for (int i = 0; i < 26; i++)
            {
                zb = (zb % 1000000007) * a[i];
                zb = zb % 1000000007;
            }
            Console.WriteLine(zb % 1000000007);
        }

    }
}