#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1061109567;
const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int cnt[26], maxx;
int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < s.size(); i++) {
    cnt[s[i] - 'A']++;
    maxx = max(maxx, cnt[s[i] - 'A']);
  }
  int num = 0;
  long long ans = 1;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] == maxx) num++;
  }
  for (int i = 0; i < n; i++) {
    ans = ans * num % mod;
  }
  cout << ans << endl;
  return 0;
}
