using System;

namespace ConsoleApp1
{
    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            if (n < 26) Console.WriteLine(-1);
            else if (n == 27) Console.WriteLine(1);
           else
            {
                int[] a = new int[26];
                int j = 0;
                int i = 0;
                while (i < 26 && j < n - 1) 
                {
                    a[i]++;
                    if (s[j] != s[j + 1]) i++;
                    j++;
                }
                a[i]++;
                double br = 1;
                for (int k = 0; k < 26; k++)
                {
                    br *= a[k];
                }
                br = br % (1000000000 + 7);
                Console.WriteLine(br);
            }
        }
    }
}