#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
char str[maxn];
int n, a[4];

int main() {
scanf("%d", &n);
scanf("%s", str);
for (int i = 0; i < n; i++) {
if (str[i] == 'A') a[0]++;
else if (str[i] == 'C') a[1]++;
else if (str[i] == 'G') a[2]++;
else if (str[i] == 'T') a[3]++;
}
int ans = 0;
for (int i = 0; i < 4; i++) {
ans = max(ans, a[i]);
}
int cnt = 0;
for (int i = 0; i < 4; i++) {
if (a[i] == ans) cnt++;
}
ans = 1;
while (n) {
if (n & 1) ans = (ll)ans * cnt % mod;
cnt = (ll)cnt * cnt % mod;
n >>= 1;
}
printf("%d\n", ans);
return 0;
}