#include <bits/stdc++.h>
using namespace std;
const int ChromeConstant = (0x100);
const int MaxN = (int)(1e5) + ChromeConstant;
const double eps = 1e-9;
const int mod = (int)(1e9) + 7;
int binpow(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = (1ll * res * a) % mod;
    a = (1ll * a * a) % mod;
    n >>= 1;
  }
  return res;
}
vector<int> v;
int k[256];
int main() {
  srand(time(0));
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) k[s[i]]++;
  for (int i = 'A'; i <= 'Z'; ++i)
    if (k[i]) v.push_back(k[i]);
  sort(v.begin(), v.end(), greater<int>());
  int cnt = 1;
  while (cnt < v.size() && v[cnt] == v[cnt - 1]) {
    cnt++;
  }
  cout << binpow(cnt, n);
  return 0;
}
