#include <bits/stdc++.h>
using namespace std;
long long expo(long long a, long long b, long long m) {
  long long result = 1;
  while (b) {
    if (b & 1) {
      result = (result * a) % m;
    }
    b = (b >> 1) % m;
    a = (a * a) % m;
  }
  return result;
}
unsigned long long msb(unsigned long long n) {
  for (long long i = 63; i >= 0; i--) {
    if ((n & (1ll << i)) != 0) return 1ll << i;
  }
  return 0;
}
struct node {
  long long val;
  int left;
} arr[1000005];
int main() {
  long long n, a[26] = {0};
  cin >> n;
  char s[100005];
  cin >> s;
  long long mx = 0;
  for (int i = 0; i < strlen(s); ++i) {
    a[s[i] - 'A']++;
    mx = max(mx, a[s[i] - 'A']);
  }
  long long ans = 0;
  for (int i = 0; i < 26; ++i) {
    if (mx == a[i]) ans++;
  }
  ans = expo(ans, strlen(s), 1000000007);
  cout << ans << endl;
}
