#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
    int n,br=0;
    cin >> n;
    string a;
    cin >> a;
    vector<long long int> b(n);
    vector<long long int> c(n);
    for (int i = 0; i < n; i++)
    {
        c[i] = 1;
    }
    
    for (int i = 0; i < 26; i++)
    {
        char ch = 90 - i;
        
        for (int j = n-1; j >= 0 ; j--)
        {
            if (j != n - 1)
            {
                b[j] = b[j + 1];
            }
            else b[j] = 0;

            if (a[j] == ch)
            {
                b[j] = (b[j] + c[j])%1000000007;
            }
        }
        for (int  k = 0; k < n; k++)
        {
            c[k] = b[k];
        }
      
    }

    cout << c[0];
}