#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007ll;
const long long _3 = 333333336ll;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
long long fpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b % 2 == 1) {
      ret *= a;
      ret %= mod;
    }
    a = a * a;
    a %= mod;
    b /= 2;
  }
  return ret;
}
struct point {
  double x, y;
  point(double x = 0, double y = 0) : x(x), y(y){};
  point operator-(const point& I) const { return point(x - I.x, y - I.y); }
};
char str[100009];
int n;
int cnt[109];
double xmult(point a, point b, point c) {
  return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
}
int h(char a) {
  if (a == 'A') return 0;
  if (a == 'C') return 1;
  if (a == 'G') return 2;
  if (a == 'T') return 3;
  return -1;
}
int MAIN() {
  scanf("%d", &n);
  scanf("%s", str);
  memset((cnt), (0), sizeof(cnt));
  for (int i = 0; str[i]; i++) {
    cnt[h(str[i])]++;
  }
  int mm = cnt[0];
  for (int i = 0; i < 4; i++) {
    mm = max(mm, cnt[i]);
  }
  int cc = 0;
  for (int i = 0; i < 4; i++) {
    if (mm == cnt[i]) cc++;
  }
  long long ans = fpow(cc, n);
  printf("%lld\n", ans);
  return 0;
}
int main() {
  MAIN();
  return 0;
}
