#include <bits/stdc++.h>
const int MAXN = 500 * 2 + 10;
using namespace std;
int n;
int ans = 1e9;
string a, b;
int kol = 0;
int anst;
void check() {
  string t1, t2;
  t1 = a;
  t2 = b;
  t1 += a;
  t2 += b;
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      for (int k = i; k < i + n; k++)
        for (int p = j; p < j + n; p++) {
          if (t1[k] == t2[p]) ans++;
        }
    }
  anst = max(anst, ans);
  if (anst == ans) {
    cout << a << ' ' << ans << endl;
    kol++;
  }
}
void bt(int i) {
  if (i == n) {
    check();
    return;
  }
  a[i] = 'A';
  bt(i + 1);
  a[i] = 'G';
  bt(i + 1);
  a[i] = 'C';
  bt(i + 1);
  a[i] = 'T';
  bt(i + 1);
}
const int MOD = 1e9 + 7;
long long binpow(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return (binpow(a, n - 1) * a) % MOD;
  else {
    long long b = (binpow(a, n / 2)) % MOD;
    return (b * b) % MOD;
  }
}
int K[100];
int main() {
  cin >> n;
  cin >> a;
  b = a;
  for (int i = 0; i < n; i++) {
    K[a[i] - 'A']++;
  }
  if (K['A' - 'A'] == n) {
    cout << '1';
    return 0;
  }
  if (K['T' - 'A'] == n) {
    cout << '1';
    return 0;
  }
  if (K['C' - 'A'] == n) {
    cout << '1';
    return 0;
  }
  if (K['G' - 'A'] == n) {
    cout << '1';
    return 0;
  }
  int m = K['A' - 'A'];
  m = max(m, K['T' - 'A']);
  m = max(m, K['G' - 'A']);
  m = max(m, K['C' - 'A']);
  int cnt = 0;
  if (K['A' - 'A'] == m) cnt++;
  if (K['T' - 'A'] == m) cnt++;
  if (K['C' - 'A'] == m) cnt++;
  if (K['G' - 'A'] == m) cnt++;
  long long d = 1;
  if (cnt != 1) d = binpow((long long)cnt, (long long)n) % MOD;
  cout << d;
}
