#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
char s1[100009];
int a[9];
long long m(int a, int b) {
  long long ans = 1;
  long long t = a;
  while (b) {
    if (b & 1) {
      ans *= t;
      ans %= mod;
    }
    b >>= 1;
    t *= t;
    t %= mod;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  cin >> s1;
  for (int i = 0; i < n; i++) {
    if (s1[i] == 'A') a[1]++;
    if (s1[i] == 'C') a[2]++;
    if (s1[i] == 'G') a[3]++;
    if (s1[i] == 'T') a[4]++;
  }
  sort(a + 1, a + 5);
  int ans = 1;
  int maxn = a[4];
  for (int i = 1; i < 4; i++)
    if (maxn == a[i]) ans++;
  printf("%lld\n", m(ans, n));
  return 0;
}
