#include <bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL) ; cout.tie(NULL); 
    
    long long int n;
    long long int k=1000000007;
    unsigned long long int p=1;
    long long int a[26];
    int x;
    int prosli=-1;
    char c;
	
	for(int i =0;i<26;i++){
		a[i]=0;
	}    
    cin>>n;
	
	if(n<=26){
		cout<<0;
	}else{
		for(long long int i = 0; i<n;i++){
    		cin>>c;
    		x=c-'0'-17;
    		//cout<<x;
    		
    		a[x]++;
    		
    		if(x>0 && prosli != x){
    			p*=a[x-1];
    			p = p % k;
			}
			prosli = x;
		}
		p*=a[25];
		p = p % k;
		cout<<p;
		//cout<<endl;
		
	}
	
	/*for(int i =0;i<26;i++){
		cout<<i<<"-"<<a[i]<<endl;
	} */
	
}
//A 17