#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a[4];
char s[N];
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'A')
      a[0]++;
    else if (s[i] == 'C')
      a[1]++;
    else if (s[i] == 'G')
      a[2]++;
    else if (s[i] == 'T')
      a[3]++;
  }
  sort(a, a + 4);
  int mx = a[3];
  long long m = 0;
  for (int i = 0; i < 4; ++i)
    if (a[i] == mx) m++;
  long long ans = 1;
  for (int i = 0; i < n; ++i) ans = (ans * m) % (1000000007);
  cout << ans << endl;
}
