#include <bits/stdc++.h>
using namespace std;
long long n;
const long long MAXN = 1e5 + 100;
long long cnt[MAXN];
string s;
const long long mod = 1e9 + 7;
long long pow2(long long x, long long y) {
  if (y == 0) return 1;
  if (y & 1)
    return pow2(x, y - 1) * x % mod;
  else {
    long long t = pow2(x, y >> 1);
    return t * t % mod;
  }
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  cin >> s;
  for (long long i = 'A'; i <= 'Z'; ++i) {
    long long cntt = 0;
    for (long long j = 0; j < n; ++j) {
      cntt += i == s[j];
    }
    cnt[cntt]++;
  }
  long long k;
  for (long long i = MAXN - 1; i >= 0; --i) {
    if (cnt[i] != 0) {
      k = i;
      break;
    }
  }
  cout << pow2(cnt[k], n);
  return 0;
}
