#include <bits/stdc++.h>
using namespace std;
long long MOD = (long long)1e9 + 7;
int addmod(int a, int b) {
  long long t = (long long)a + b;
  if (t >= MOD) t = t % MOD;
  return t;
}
int submod(int a, int b) {
  int t = a - b;
  t = t < 0 ? t + MOD : t;
  return t;
}
int mulmod(int a, int b) {
  long long t = (long long)a * b;
  if (t >= MOD) t = t % MOD;
  return t;
}
int epowmod(int a, int p) {
  if (p == 0) return 1;
  int t = epowmod(a, p / 2);
  t = mulmod(t, t);
  if (p & 1) t = mulmod(t, a);
  return t;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, j;
  int n;
  cin >> n;
  ;
  string str;
  cin >> str;
  vector<int> arr(26, 0);
  for (i = 0; i < n; i++) arr[str[i] - 'A']++;
  int mx = *max_element((arr).begin(), (arr).end());
  int cnt = count((arr).begin(), (arr).end(), mx);
  cout << epowmod(cnt, n) << '\n';
}
