#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
int a, b, i, d[1011000], j, k, n, m, timer = 0, l, r, x, y;
int c[1011000], cnt = 0, fl = 0, a2, a3 = -1000000;
string s, t = "ACGT";
map<char, int> mp, mp2;
long long int res, ans = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) {
    mp[s[i]]++;
    cnt = max(cnt, mp[s[i]]);
  }
  for (i = 0; i < 4; i++) {
    if (mp[t[i]] == cnt) ans++;
  }
  res = 1ll;
  for (i = 0; i < n; i++) {
    res *= ans;
    res %= (1000000007ll);
  }
  cout << res << endl;
  return 0;
}
