#include <bits/stdc++.h>
using namespace std;
char s[100010];
long long n;
long long a[10];
inline long long check(char x) {
  if (x == 'A') return 1;
  if (x == 'C') return 2;
  if (x == 'G') return 3;
  if (x == 'T') return 4;
}
long long ans[100010][10], f[100010][10];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (long long i = 1; i <= n; i++) a[check(s[i])]++;
  f[0][1] = 1;
  for (long long i = 1; i <= n; i++)
    for (int j = 1; j <= 4; j++)
      for (long long k = 1; k <= 4; k++) {
        if (ans[i - 1][k] + a[j] * n > ans[i][j]) {
          ans[i][j] = ans[i - 1][k] + a[j] * n;
          f[i][j] = f[i - 1][k];
        } else if (ans[i - 1][k] + a[j] * n == ans[i][j]) {
          (f[i][j] += f[i - 1][k]) %= 1000000007;
        }
      }
  long long Now = -1, Fang = 0;
  for (long long i = 1; i <= 4; i++) {
    if (ans[n][i] > Now) {
      Now = ans[n][i], Fang = f[n][i];
    } else if (ans[n][i] == Now) {
      (Fang += f[n][i]) %= 1000000007;
    }
  }
  printf("%I64d\n", Fang);
}
