#include <bits/stdc++.h>
int setbit(int N, int pos) { return N = N | (1 << pos); }
int resetbit(int N, int pos) { return N = N & ~(1 << pos); }
bool checkbit(int N, int pos) { return (bool)(N & 1 << pos); }
using namespace std;
long long int bigmod(long long int a, long long int p) {
  if (p == 0) return 1;
  if (p % 2) {
    return ((a % 1000000007) * (bigmod(a, p - 1))) % 1000000007;
  } else {
    long long c = bigmod(a, p / 2);
    return ((c % 1000000007) * (c % 1000000007)) % 1000000007;
  }
}
int main() {
  string s;
  int n;
  cin >> n >> s;
  int dif = 0;
  int vis[4];
  memset(vis, false, sizeof(vis));
  for (int i = 0; i < (int)s.size(); i++) {
    if (s[i] == 'A')
      vis[0]++;
    else if (s[i] == 'C')
      vis[1]++;
    else if (s[i] == 'G')
      vis[2]++;
    else if (s[i] == 'T')
      vis[3]++;
  }
  int m = vis[0];
  int cnt = 1;
  for (int i = 1; i < 4; i++) {
    if (vis[i] > m) {
      cnt = 1;
      m = vis[i];
    } else if (vis[i] == m)
      cnt++;
  }
  cout << bigmod(cnt, n) << endl;
}
