#include <bits/stdc++.h>
using namespace std;
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                       {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
char str[MAXN];
const int A = 0, G = 1, C = 2, T = 3;
int f[4];
int n;
int main() {
  scanf("%d", &n);
  scanf("%s", str);
  memset(f, 0, sizeof f);
  for (int i = 0; i < n; i++) {
    if (str[i] == 'A')
      f[A]++;
    else if (str[i] == 'G')
      f[G]++;
    else if (str[i] == 'C')
      f[C]++;
    else
      f[T]++;
  }
  int max = f[A];
  int count = 1;
  for (int i = 1; i < 4; i++) {
    if (max < f[i]) {
      count = 1;
      max = f[i];
    } else if (max == f[i]) {
      count++;
    }
  }
  long long ans = 1;
  for (int i = 0; i < n; i++) {
    ans = (ans * count) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
