#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int n, cnt[1000];
char a[4] = {'A', 'C', 'G', 'T'};
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) cnt[s[i]]++;
  long long c = 0;
  int m = 0;
  for (int i = 0; i < 4; i++) m = max(m, cnt[a[i]]);
  for (int i = 0; i < 4; i++)
    if (cnt[a[i]] == m) c++;
  long long res = 1;
  for (int i = 0; i < n; i++) res = (res * c), res %= 1000000000 + 7;
  cout << res;
  return 0;
}
