#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mk make_pair
#define v_sort(x) sort(x.begin(),x.end())
#define v_gsort(x) sort(x.begin(),x.end(),greater<int>())
#define v_find(x,num) find(x.begin(),x.end(),num)
#define PI 3.14159265
#define MOD 998244353
#define MOD1 1000000007

using namespace std;

void Solve(){
  ll n;
  cin>>n;
  string s;
  string alp="";
  for(int i=0;i<26;i++){
    alp+=((int)'A'+i);
  }
  cin>>s;
  if(n<=26) cout<<"0\n";
  else if(n==27){\
    int num=0;
    for(int i=0;i<n;i++) if(s[i]==alp[num]) num++;
    cout<<(num==26?"1":"0")<<'\n';
  }
  else{
    char c='A';
    s+='*';
    ll ans=1,tm=0;
    for(int i=0;i<=n;i++){
      if(c==s[i]) tm++;
      else c=s[i],ans=(ans*tm)%MOD1,tm=1;
    }
    cout<<ans;
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t=1;
//  cin>>t;
  while(t--){
    Solve();
  }
  return 0;
}