#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int mod = 1e9 + 7;
char s[N];
int f[5];
int p(int a, int n) {
  if (n == 0) return 1;
  int x = p(a, n / 2);
  long long ans = (long long)x * x % mod;
  if (n % 2 == 1) ans = ans * a % mod;
  return (int)ans;
}
int main() {
  int n;
  scanf("%d", &n);
  memset(s, 0, sizeof(s));
  memset(f, 0, sizeof(f));
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A')
      f[1]++;
    else if (s[i] == 'T')
      f[2]++;
    else if (s[i] == 'C')
      f[3]++;
    else
      f[4]++;
  }
  int maxn = 0, di = 0;
  for (int i = 1; i <= 4; i++)
    if (maxn < f[i]) maxn = f[i];
  for (int i = 1; i <= 4; i++)
    if (f[i] == maxn) di++;
  int ans = p(di, n);
  printf("%d", ans);
  return 0;
}
