#include <bits/stdc++.h>
using namespace std;
void set(int& n, int first) { n = n | (1 << first); }
void reset(int& n, int first) { n = n & ~(1 << first); }
bool check(int n, int first) { return (bool)(n & (1 << first)); }
const int mx = 100005;
char s[mx];
long long bigMod(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return ans;
}
int main() {
  int i, j, k, n;
  while (scanf("%d%s", &n, s) == 2) {
    int a[26];
    memset(a, 0, sizeof a);
    for (i = 0; i < n; i++) a[s[i] - 'A']++;
    int m = 0;
    for (i = 0; i < 26; i++) m = max(m, a[i]);
    int c = 0;
    for (i = 0; i < 26; i++)
      if (m == a[i]) c++;
    int ans = bigMod(c, n);
    printf("%d\n", ans);
  }
}
