#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long INF = 1e7;
double EPS = 1e-12;
const long long lim = 2e5 + 100;
long long powP(long long x, long long y) {
  long long ans = 1, po = x % mod;
  while (y > 0) {
    if (y & 1) ans = ans * po % mod;
    y >>= 1;
    po = po * po % mod;
  }
  return ans;
}
vector<long long> V;
long long A[lim];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int T, i, p, j, l, e, r, b, c, k, m, q, a, d, w, x, y, u, v, z, t,
      curr, prev, sum, val, countA = 0, indicator = 0, pos, h, minA, maxA, type,
                            n, ans = 0;
  string S;
  map<char, long long> M;
  cin >> n >> S;
  for (auto i : S) {
    M[i]++;
  }
  maxA = 0;
  for (auto i : M) {
    maxA = max(maxA, i.second);
  }
  for (auto i : M) {
    if (i.second == maxA) countA++;
  }
  cout << powP(countA, n) << endl;
  return 0;
}
