#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const char letters[] = {'A', 'T', 'G', 'C'};
int n, a[222];
string s;
int main() {
  cin >> n >> s;
  for (int i = 0; i < s.length(); ++i) {
    ++a[s[i]];
  }
  int mx = 0, cnt = 0;
  for (int i = 0; i < 4; ++i) {
    mx = max(mx, a[letters[i]]);
  }
  for (int i = 0; i < 4; ++i) {
    if (mx == a[letters[i]]) {
      ++cnt;
    }
  }
  long long ans = 1;
  for (int i = 0; i < s.length(); ++i) {
    ans *= cnt;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
