#include <bits/stdc++.h>
using namespace std;
long long mod[100005];
int n, m, mx, cn;
int cnt[26];
string s;
void Set(int cn) {
  mod[0] = 1;
  for (int i = 1; i < 100001; i++) {
    mod[i] = (i % 2 == 1 ? cn * mod[i - 1] : mod[i / 2] * mod[i / 2]);
    mod[i] %= 1000000007;
  }
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cnt[s[i] - 'A']++;
    mx = (mx >= cnt[s[i] - 'A'] ? mx : cnt[s[i] - 'A']);
  }
  for (int i = 0; i < 26; i++)
    if (cnt[i] == mx) cn++;
  Set(cn);
  cout << mod[n] << endl;
  return 0;
}
