#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long n;
    scanf("%d", &n);
    long long maks = 1000000007;
    long long a[26];
    for(long long i = 0; i < 26; i++)
        a[i] = 0;
    char c;
    scanf("%c", &c);
    int input, current = -1;
    for(long long i = 0; i < n; i++)
    {
        scanf("%c", &c);
        input = (int)c - 65;
        if(input == current+1)
        {
            current++;
            a[input] = 1;
        }
        else if(input == current)
        {
            a[input]++;
        }
    }
    long long rez = 1;
    for(long long i = 0; i < 26; i++)
    {
        printf("a[%lld] = %lld\n", i, a[i]);
        rez = (rez*a[i])%maks;
    }
    printf("%lld", rez);
    return 0;
}