#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1), eps = 1e-9;
ll fast_pow(int a, int p) {
  ll res = 1;
  while (p) {
    if (p % 2 == 0) {
      a = a * 1ll * a % mod;
      p /= 2;
    } else {
      res = res * 1ll * a % mod;
      p--;
    }
  }
  return res;
}
ll fact(int n) {
  ll res = 1;
  for (int i = 1; i <= n; i++) {
    res = res * 1ll * i % mod;
  }
  return res;
}
ll c(int n, int k) {
  return fact(n) * 1ll * fast_pow(fact(k), mod - 2) % mod * 1ll *
         fast_pow(fact(n - k), mod - 2) % mod;
}
const int mxn = 1e3, mxa = 1e9, mxk = 10;
int n;
string second, t;
int p() {
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      string s1 = second.substr(i, n - i) + second.substr(0, i);
      string s2 = t.substr(j, n - j) + t.substr(0, j);
      cout << s1 << ' ' << s2 << '\n';
      for (int k = 0; k < n; ++k)
        if (s1[k] == s2[k]) ++ans;
    }
  }
  return ans;
}
void solve() {
  cin >> n >> second;
  int cnt[4] = {};
  for (int i = 0; i < n; ++i) {
    if (second[i] == 'A')
      ++cnt[0];
    else if (second[i] == 'C')
      ++cnt[1];
    else if (second[i] == 'G')
      ++cnt[2];
    else
      ++cnt[3];
  }
  sort(cnt, cnt + 4);
  ll ans = 1, d;
  if (cnt[3] > cnt[2])
    d = 1;
  else if (cnt[2] > cnt[1])
    d = 2;
  else if (cnt[1] > cnt[0])
    d = 3;
  else
    d = 4;
  for (int i = 0; i < n; ++i) ans = (ans * d) % mod;
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
