#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
char s[1 << 17];
int n;
long long powmod(long long a, int x) {
  if (x == 0) return 1;
  if (x & 1) return a * powmod(a * a % MOD, x / 2) % MOD;
  return powmod(a * a % MOD, x / 2);
}
int main() {
  scanf("%d", &n);
  scanf("%s", s);
  map<char, int> M;
  for (int i = 0; s[i]; ++i) M[s[i]]++;
  vector<int> v;
  for (map<char, int>::iterator it = M.begin(); it != M.end(); ++it)
    v.push_back(it->second);
  sort(v.rbegin(), v.rend());
  int cnt = 0;
  int i = 1;
  while (i < v.size() && v[i - 1] == v[i]) ++i;
  printf("%d\n", (int)powmod(i, n));
  return 0;
}
