#include <bits/stdc++.h>
using namespace std;
int n;
char s[1000005];
int a[50];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    a[s[i] - 'A' + 1]++;
  }
  sort(a + 1, a + 27);
  int k = 0;
  for (int i = 26; i >= 1; i--) {
    if (a[i] != a[i - 1]) {
      k = 26 - i + 1;
      break;
    }
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    ans = ans * k % 1000000007;
  }
  printf("%I64d\n", ans);
  return 0;
}
