#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
string s;
long long m, Count[300];
long long n;
long long mx = -(long long)(1e18);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (long long i = 0; i < n; ++i) {
    Count[s[i]]++;
  }
  for (long long i = 'A'; i <= 'Z'; ++i) {
    if (Count[i] > mx) mx = Count[i];
  }
  for (long long i = 'A'; i <= 'Z'; ++i) {
    if (Count[i] == mx) ++m;
  }
  long long res = 1;
  for (long long i = 0; i < n; ++i) {
    res = res * m % mod;
  }
  cout << res;
  return 0;
}
