#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long ksm(long long a, long long b) {
  long long res = 1ll;
  while (b != 0) {
    if (b & 1) res = (res * a) % mod;
    b >>= 1;
    a = (a * a) % mod;
  }
  return res;
}
long long n;
int vis[4];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    if (c == 'A')
      vis[0]++;
    else if (c == 'G')
      vis[1]++;
    else if (c == 'C')
      vis[2]++;
    else if (c == 'T')
      vis[3]++;
  }
  sort(vis, vis + 4);
  int maxn = vis[3];
  long long cnt = 0;
  for (int i = 0; i < 4; i++)
    if (vis[i] == maxn) cnt++;
  cout << ksm(cnt, n) << endl;
  return 0;
}
