#include <bits/stdc++.h>
using namespace std;
int n;
char a[100003];
int ct[4];
int cmp(int a, int b) { return a > b; }
int main() {
  scanf("%d%s", &n, a);
  for (int i = 0; i < n; ++i)
    if (a[i] == 'A')
      ++ct[0];
    else if (a[i] == 'T')
      ++ct[1];
    else if (a[i] == 'G')
      ++ct[2];
    else if (a[i] == 'C')
      ++ct[3];
  sort(ct, ct + 4, cmp);
  long long ans = 1;
  int x = 1;
  for (int i = 1; i < 4; ++i)
    if (ct[i] == ct[i - 1])
      ++x;
    else
      break;
  for (int i = 0; i < n; ++i) ans = (ans * x) % 1000000007;
  cout << ans << endl;
  return 0;
}
