#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;
int n;
string second;
int binpow(int a, int n) {
  int res = 1;
  while (n) {
    if (n & 1) {
      res = res * 1ll * a % mod;
    }
    a = a * 1ll * a % mod;
    n /= 2;
  }
  return res;
}
int main() {
  cin >> n;
  cin >> second;
  map<char, int> M;
  for (int i = 0; i < second.length(); i++) {
    M[second[i]]++;
  }
  int maxi = 0;
  for (__typeof(M.begin()) it = M.begin(); it != M.end(); it++) {
    maxi = max(maxi, it->second);
  }
  int cnt = 0;
  for (__typeof(M.begin()) it = M.begin(); it != M.end(); it++) {
    if (it->second == maxi) cnt++;
  }
  cout << binpow(cnt, n) << endl;
  return 0;
}
