#include <bits/stdc++.h>
using namespace std;
char str[100100];
int f[220];
int main() {
  int n;
  scanf("%d", &n);
  scanf(" %s", str);
  int fm = -1;
  for (int i = 0; i < n; i++) {
    f[str[i]]++;
    if (f[str[i]] > fm) fm = f[str[i]];
  }
  int a = 0;
  if (f['A'] == fm) a++;
  if (f['T'] == fm) a++;
  if (f['C'] == fm) a++;
  if (f['G'] == fm) a++;
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (ans * a) % 1000000007;
  cout << ans << endl;
}
