#include <bits/stdc++.h>
using namespace std;
long long const MAXN = 2e5 + 10;
long long const mod = 1e9 + 7;
long long n, m, T;
string s;
long long num[30];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> s;
  long long MAX = 0;
  for (long long i = 0; i < s.size(); i++) {
    num[s[i] - 'A']++;
    MAX = max(MAX, num[s[i] - 'A']);
  }
  long long ans = 0;
  if (num['A' - 'A'] == MAX) ans++;
  if (num['T' - 'A'] == MAX) ans++;
  if (num['C' - 'A'] == MAX) ans++;
  if (num['G' - 'A'] == MAX) ans++;
  long long res = 1;
  for (long long i = 0; i < n; i++) res = ans * res % mod;
  cout << res;
  return 0;
}
