#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128000000")
using namespace std;
const int N = 1e5 + 200;
const int INF = int(1e9) + 7;
const long long LINF = 1ll * INF * INF;
const int md = int(1e9) + 7;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
int n, mx, p;
int cnt[26];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  mx = 1;
  for (int i = 0; i < n; i++) {
    char ch;
    cin >> ch;
    cnt[ch - 'A']++;
    mx = max(mx, cnt[ch - 'A']);
  }
  for (int i = 0; i < 26; i++)
    if (mx == cnt[i]) p++;
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (1LL * p * ans) % md;
  cout << ans << endl;
  return 0;
}
