#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
template <class T>
inline bool read(T &n) {
  T x = 0, tmp = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-' && c != EOF) c = getchar();
  if (c == EOF) return false;
  if (c == '-') c = getchar(), tmp = -1;
  while (c >= '0' && c <= '9') x *= 10, x += (c - '0'), c = getchar();
  n = x * tmp;
  return true;
}
template <class T>
inline void write(T n) {
  if (n < 0) {
    putchar('-');
    n = -n;
  }
  int len = 0, data[20];
  while (n) {
    data[len++] = n % 10;
    n /= 10;
  }
  if (!len) data[len++] = 0;
  while (len--) putchar(data[len] + 48);
}
const long long MOD = 1e9 + 7;
inline int idx(char a) {
  if (a == 'A') return 0;
  if (a == 'G') return 1;
  if (a == 'C') return 2;
  if (a == 'T') return 3;
}
long long qpow(long long a, long long n) {
  long long c = 1;
  while (n) {
    if (n & 1) c = (c * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return c;
}
char str[100010];
int num[4];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", str);
  for (int i = 0; str[i]; i++) num[idx(str[i])]++;
  int maxx = -1, cnt = 0;
  for (int i = 0; i < 4; i++) {
    if (num[i] > maxx) {
      maxx = num[i];
      cnt = 1;
    } else if (num[i] == maxx)
      cnt++;
  }
  if (cnt == 1)
    puts("1");
  else {
    long long ans = qpow(cnt, n);
    write(ans % MOD), putchar('\n');
  }
  return 0;
}
