#include <bits/stdc++.h>
using namespace std;
void show() { cout << '\n'; }
template <typename T, typename... Args>
void show(T a, Args... args) {
  cout << a << " ";
  show(args...);
}
template <typename T>
void show_c(T& a) {
  for (auto& x : a) {
    cout << x << " ";
  }
  cout << endl;
}
long long BigMod(long long a, long long p, long long m) {
  long long res = 1;
  long long x = a;
  while (p) {
    if (p & 1) {
      res = (res * x) % m;
    }
    x = (x * x) % m;
    p = p >> 1;
  }
  return res % m;
}
int cnt[300] = {0};
char str[100100];
int n;
long long mod = 1e9 + 7 + 1e-6;
int main() {
  scanf("%d %s", &n, str);
  for (int i = 0; str[i]; ++i) {
    cnt[str[i]]++;
  }
  int mx = 0;
  for (int i = 0; i < 300; ++i) {
    mx = max(mx, cnt[i]);
  }
  int sum = 0;
  for (int i = 0; i < 300; ++i) {
    if (cnt[i] == mx) {
      sum++;
    }
  }
  show(BigMod(sum, n, mod));
  return 0;
}
