#include <bits/stdc++.h>
long long int vis[5];
long long int cont[5];
char a[100006];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    scanf("%s", a);
    memset(cont, 0, sizeof(cont));
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; i++) {
      if (a[i] == 'A') vis[0]++;
      if (a[i] == 'C') vis[1]++;
      if (a[i] == 'T') vis[2]++;
      if (a[i] == 'G') vis[3]++;
    }
    for (int i = 0; i < 4; i++) {
      if (vis[i] == 0) continue;
      for (int j = 0; j < 4; j++) {
        if (vis[i] == vis[j]) cont[i]++;
      }
    }
    long long int maxn = 0;
    long long int contz = 0;
    for (int i = 0; i < 4; i++) {
      if (vis[i] > maxn) {
        maxn = vis[i];
        contz = cont[i];
      }
    }
    long long int output = 1;
    for (int i = 0; i < n; i++) {
      output *= contz;
      output %= 1000000007;
    }
    printf("%I64d\n", output);
  }
}
