#include <bits/stdc++.h>
using namespace std;
int a[10], n;
char s[120000];
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'A')
      a[0]++;
    else if (s[i] == 'C')
      a[1]++;
    else if (s[i] == 'G')
      a[2]++;
    else
      a[3]++;
  }
  int ret = 0, k = 0;
  for (int i = 0; i < 4; ++i) ret = max(ret, a[i]);
  for (int i = 0; i < 4; ++i)
    if (a[i] == ret) k++;
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    ans = ans * k % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
