#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int P = 1000 * 1000 * 1000 + 7;
int mult(long long a, long long b) { return (a * b) % P; }
int pow_mod(int a, int n) {
  if (n == 0) return 1;
  int res = pow_mod(a, n / 2);
  res = mult(res, res);
  if (n % 2 == 1) res = mult(res, a);
  return res;
}
const int MAXN = 120 * 1000;
char s[MAXN];
int num[30];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; i < n; ++i) {
    num[s[i] - 'A']++;
  }
  int max_num = 0;
  int n_max = 0;
  for (int i = 0; i < 26; ++i) {
    if (num[i] > max_num) {
      max_num = num[i];
      n_max = 0;
    }
    if (num[i] == max_num) {
      n_max++;
    }
  }
  int ans = pow_mod(n_max, n);
  printf("%d\n", ans);
  return 0;
}
