#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
char s[SIZE];
int cnt[128];
long long mypow(long long x, long long y) {
  x %= MOD;
  long long res = 1 % MOD;
  while (y) {
    if (y & 1) res = res * x % MOD;
    y >>= 1;
    x = x * x % MOD;
  }
  return res;
}
int main() {
  int(n);
  scanf("%d", &n);
  scanf("%s", (s));
  for (int i = 0; i < (n); ++i) {
    cnt[s[i]]++;
  }
  int ma = -1, num = 0;
  for (int i = 0; i < (128); ++i) {
    if (cnt[i] > ma) {
      ma = cnt[i];
      num = 1;
    } else if (cnt[i] == ma) {
      num++;
    }
  }
  cout << mypow(num, n) << endl;
  return 0;
}
