#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int cnt[200];
char s[112345];
const char *alpha = "AGCT";
int MAIN() {
  int n;
  scanf("%d%s", &n, s);
  for (int i = 0; s[i]; ++i) {
    cnt[s[i]]++;
  }
  int mx = -1, t = 0;
  for (int i = 0; alpha[i]; ++i) {
    if (mx < cnt[alpha[i]]) {
      mx = cnt[alpha[i]];
      t = 1;
    } else if (mx == cnt[alpha[i]]) {
      t++;
    }
  }
  long long res = 1;
  while (n--) {
    res = (res * t) % mod;
  }
  cout << res << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  int ret = MAIN();
  return ret;
}
