#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
char str[maxn];
int n, a[4];
int main() {
  cin >> n;
  cin >> str;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'A')
      a[0]++;
    else if (str[i] == 'C')
      a[1]++;
    else if (str[i] == 'G')
      a[2]++;
    else if (str[i] == 'T')
      a[3]++;
  }
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    ans = max(ans, a[i]);
  }
  int cnt = 0;
  for (int i = 0; i < 4; i++) {
    if (a[i] == ans) cnt++;
  }
  ans = 1;
  while (n) {
    if (n & 1) ans = (long long)ans * cnt % mod;
    cnt = (long long)cnt * cnt % mod;
    n >>= 1;
  }
  cout << ans;
  return 0;
}
