#include <bits/stdc++.h>
using namespace std;
long long BigMod(long long base, long long power) {
  if (power == 0) {
    return (long long)1;
  }
  long long half = power / 2;
  long long ret = BigMod(base, half);
  ret = (ret * ret) % 1000000007;
  if ((power & 1)) {
    ret = (ret * base) % 1000000007;
  }
  return ret;
}
int N;
string s;
long long cnt[10];
int main() {
  cin >> N;
  cin >> s;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < N; i++) {
    if (s[i] == 'A') {
      cnt[0]++;
    } else if (s[i] == 'C') {
      cnt[1]++;
    } else if (s[i] == 'G') {
      cnt[2]++;
    } else {
      cnt[3]++;
    }
  }
  sort(cnt, cnt + 4);
  reverse(cnt, cnt + 4);
  long long option = 0;
  for (int i = 0; i < 4; i++) {
    if (cnt[i] == cnt[0]) {
      option++;
    } else {
      break;
    }
  }
  long long ret = BigMod(option, N);
  cout << ret << endl;
  return 0;
}
