#include <bits/stdc++.h>
using namespace std;
class C_ {};
template <typename T>
C_& operator<<(C_& __m, const T& __s) {
  if (!1) cerr << "\E[91m" << __s << "\E[0m";
  return __m;
}
C_ merr;
struct __s {
  __s() {
    if (1) {
      ios_base::Init i;
      cin.sync_with_stdio(0);
      cin.tie(0);
    }
  }
  ~__s() {
    merr << "Execution time: " << (double)clock() / CLOCKS_PER_SEC << " s.\n";
  }
} __S;
int C[4];
char CC[] = {'A', 'C', 'T', 'G'};
long long P[5][111111];
const long long mod = 1000000007LL;
int main(void) {
  string s;
  int n;
  for (int a = 1; a <= 4; a++) {
    P[a][0] = 1;
    for (int i = 1; i < 111111; i++) {
      P[a][i] = (P[a][i - 1] * a) % mod;
    }
  }
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    char c = s[i];
    for (int j = 0; j < 4; j++) {
      if (c == CC[j]) {
        C[j]++;
      }
    }
  }
  sort(C, C + 4, greater<int>());
  if (C[0] == C[1] && C[1] == C[2] && C[2] == C[3]) {
    cout << P[4][n] << '\n';
  } else if (C[0] == C[1] && C[1] == C[2]) {
    cout << P[3][n] << '\n';
  } else if (C[0] == C[1]) {
    cout << P[2][n] << '\n';
  } else {
    cout << "1" << '\n';
  }
  return 0;
}
