#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void read(Tp &x) {
  static char c;
  static bool neg;
  c = getchar(), neg = false, x = 0;
  for (; !isdigit(c); c = getchar()) {
    if (c == '-') {
      neg = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (neg) {
    x = -x;
  }
}
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
int n;
char str[N];
int cnt[26];
inline int power(int base, int exp) {
  int res = 1;
  while (exp > 0) {
    if (exp & 1) {
      res = (long long)res * base % MOD;
    }
    base = (long long)base * base % MOD;
    exp >>= 1;
  }
  return res;
}
int main() {
  read(n);
  scanf("%s", str);
  for (int i = 0; i < n; ++i) {
    ++cnt[str[i] - 'A'];
  }
  int ans = 0, mx = *max_element(begin(cnt), end(cnt));
  for (const auto &x : cnt) {
    if (x == mx) {
      ++ans;
    }
  }
  printf("%d\n", power(ans, n));
}
