#include <bits/stdc++.h>
using namespace std;
int n, as = 0, cs = 0, gs = 0, ts = 0, t;
char str[100010];
long long ans = 1, MOD = 1000000007, k = 0;
int main() {
  scanf("%d", &n);
  scanf("%s", str);
  for (int i = 0; i < n; i++) {
    if (str[i] == 'A')
      as++;
    else if (str[i] == 'C')
      cs++;
    else if (str[i] == 'G')
      gs++;
    else if (str[i] == 'T')
      ts++;
  }
  t = max(as, max(cs, max(gs, ts)));
  if (t == as) k++;
  if (t == cs) k++;
  if (t == gs) k++;
  if (t == ts) k++;
  for (int i = 0; i < n; i++) {
    ans = (ans * k) % MOD;
  }
  cout << ans;
  return 0;
}
