#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    char a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];

    int res, counter;

    if(n <= 26)
        cout << 0;
    else
    {
        res = 1;
        counter = 0;
        for(int i = 0; i < n; i++)
        {
            if(i = n - 1)
            {
                if(a[i] == a[i-1])
                    counter++;
            }
            else if(a[i] == a[i+1])
                counter++;
            else if(a[i] == a[i-1])
                counter++;
            else
            {
                if(counter != 0)
                {
                    res *= counter;
                    counter = 0;
                }
            }
        }
    }
    int br = pow(10, 9) + 7;
    int res1 = res % br;
    cout << res1;

    return 0;
}