#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n;
string s;
int t[30];
int a[2100];
int cnt;
long long ans=1;
long long inv(int a,int t){
long long res = 1;
while(t){
if(t&1)res=(long long)res*a%mod;
a=(long long)a*a%mod;
t>>=1;
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
a[0]=1;
for(int i=1; i<=2100; i++) {
a[i]=a[i-1]*i%mod;
}
cin>>n>>s;
for(int i=1; i<=n; i++) {
t[s[i-1]-'a']++;
}
//cout<<cnt;//c
for(int i=0; i<26; i++) {
//cout<<t[i]<<'\n';
if(t[i]%2==1) {
//cout<<"cnt:"<<cnt<<'\n';
if(cnt==0) {
cnt++;
t[i]--;
} else {
cout<<a[n];
return 0;
}
}
if(t[i]) {
ans=ans*a[t[i]]%mod*inv(a[t[i]/2],mod-2)%mod;
//cout<<"ans:"<<ans<<'\n';//c
}
}
cout<<a[n]-(ans*a[(n-cnt)/2]%mod);
return 0;
}
注:只给代码的不关