#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 11;
const int Mod = 1e9 + 7;
char str[N];
int n;
long long arr[5];
long long brr[N];
long long crr[N];
long long drr[N];
void init() {
  brr[0] = crr[0] = drr[0] = 1;
  for (int i = 1; i < N; ++i) {
    brr[i] = (brr[i - 1] * 2) % Mod;
    crr[i] = (crr[i - 1] * 3) % Mod;
    drr[i] = (drr[i - 1] * 4) % Mod;
  }
}
void work() {
  if (arr[2] < arr[3]) {
    printf("1\n");
  } else if (arr[1] < arr[2]) {
    printf("%I64d\n", brr[n]);
  } else if (arr[0] < arr[1]) {
    printf("%I64d\n", crr[n]);
  } else {
    printf("%I64d\n", drr[n]);
  }
}
int main() {
  init();
  scanf("%d", &n);
  scanf("%s", str);
  for (int i = 0; i < n; ++i) {
    if (str[i] == 'A') ++arr[0];
    if (str[i] == 'G') ++arr[1];
    if (str[i] == 'C') ++arr[2];
    if (str[i] == 'T') ++arr[3];
  }
  sort(arr, arr + 4);
  work();
}
