#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
char s[100010];
long long power(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % MOD)
    if (y & 1) ret = ret * x % MOD;
  return ret;
}
int main(int argc, const char* argv[]) {
  int l;
  scanf("%d", &l);
  scanf("%s", s + 1);
  long long a[4];
  a[0] = a[1] = a[2] = a[3] = 0;
  long long ans = 1;
  for (int i = 1; i <= l; ++i) {
    if (s[i] == 'A') ++a[0];
    if (s[i] == 'C') ++a[1];
    if (s[i] == 'G') ++a[2];
    if (s[i] == 'T') ++a[3];
  }
  sort(a, a + 4);
  int num = 1;
  for (int i = 0; i < 4; ++i)
    if (a[i] == a[3]) {
      num = 4 - i;
      break;
    }
  cout << power(num, l) << endl;
  return 0;
}
