#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1E5 + 5;
const string alphabet = "ACGT";
int n, cnt[4];
char s[MAXN];
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  int maxCnt = 0;
  for (int i = 0; i < n; ++i) ++cnt[alphabet.find(s[i])];
  for (int i = 0; i < 4; ++i) maxCnt = max(maxCnt, cnt[i]);
  int res = 0;
  for (int i = 0; i < 4; ++i)
    if (maxCnt == cnt[i]) ++res;
  long long ans = 1;
  for (int i = 0; i < n; ++i) ans = (ans * res) % 1000000007;
  cout << ans;
}
