#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int cnt[4];
int main() {
  int n;
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; ++i) {
    char ch = getchar();
    if (ch == 'A') {
      ++cnt[0];
    } else if (ch == 'C') {
      ++cnt[1];
    } else if (ch == 'G') {
      ++cnt[2];
    } else if (ch == 'T') {
      ++cnt[3];
    }
  }
  int mx = *max_element(cnt, cnt + 4);
  int nMax = count(cnt, cnt + 4, mx);
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    ans = (ans * nMax) % mod;
  }
  cout << ans << endl;
}
