#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
char s[100005];
int cnt[30];
int key(char ch) {
  if (ch == 'A') return 0;
  if (ch == 'C') return 1;
  if (ch == 'G') return 2;
  return 3;
}
inline int Exp(int a, int p) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1LL * res * a % mod;
    p >>= 1;
    a = 1LL * a * a % mod;
  }
  return res;
}
int main() {
  int n;
  scanf("%d%s", &n, s);
  for (int i = 0; s[i]; ++i) ++cnt[key(s[i])];
  int maxc = *max_element(cnt, cnt + 4);
  int p = 0;
  for (int i = 0; i < 4; ++i) {
    if (cnt[i] == maxc) ++p;
  }
  printf("%d\n", Exp(p, n));
  return 0;
}
