#include <bits/stdc++.h>
using namespace std;
int n, c[5], e = 4;
char s[100005];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] == 'A') c[1]++;
    if (s[i] == 'C') c[2]++;
    if (s[i] == 'G') c[3]++;
    if (s[i] == 'T') c[4]++;
  }
  sort(c + 1, c + 1 + 4);
  if (c[3] == c[4]) {
    e--;
    if (c[2] == c[3]) {
      e--;
      if (c[1] == c[2]) e--;
    }
  }
  int ans = 1;
  e = 4 - e + 1;
  for (int i = 1; i <= n; ++i) ans = (long long)ans * e % 1000000007;
  printf("%d\n", ans);
}
