#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
int pw(int a, int b) {
  if (b == 0) return 1;
  long long t = pw(a, b / 2);
  t = (t * t) % mod;
  if (b % 2) t = (t * a) % mod;
  return t;
}
int arr[26];
int main() {
  int n, i, j;
  string str;
  cin >> n >> str;
  for (i = 0; i < n; i++) arr[str[i] - 'A']++;
  int mx = 0;
  for (i = 0; i < 26; i++) mx = max(mx, arr[i]);
  int k = 0;
  for (i = 0; i < 26; i++) {
    if (arr[i] == mx) k++;
  }
  cout << pw(k, n) << endl;
  return 0;
}
