#include <bits/stdc++.h>
using namespace std;
int N;
int cnt[26];
char A[100005];
int main() {
  scanf("%d%s", &N, A + 1);
  for (int i = 1; i <= N; i++) cnt[A[i] - 'A']++;
  int mx = -1, mxc = 0;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] > mx)
      mx = cnt[i], mxc = 1;
    else if (cnt[i] == mx)
      mxc++;
  }
  int MOD = 1e9 + 7;
  int ans = 1;
  for (int i = 0; i < N; i++) ans = (long long)ans * mxc % MOD;
  printf("%d\n", ans);
}
