#include <bits/stdc++.h>
using namespace std;
int n;
string in;
string s = "ATCG";
map<char, long long> a;
long long maxn = -1, cnt, ans = 1;
int main() {
  cin >> n;
  cin >> in;
  for (int i = 0; i < n; i++) a[in[i]]++;
  for (int i = 0; i < 4; i++) {
    if (a[s[i]] == maxn)
      cnt++;
    else if (a[s[i]] > maxn) {
      maxn = a[s[i]];
      cnt = 1;
    }
  }
  while (n) {
    if (n % 2) ans = (ans * cnt) % 1000000007;
    n /= 2;
    cnt = (cnt * cnt) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
