#include <bits/stdc++.h>
using namespace std;
map<char, int> cc;
int main() {
  int n;
  scanf("%d ", &n);
  for (int i = 0; i < n; ++i) {
    ++cc[getchar()];
  }
  int a = 0, b = 0;
  for (auto p : cc)
    if (p.second > a) {
      a = p.second;
      b = 1;
    } else if (p.second == a)
      ++b;
  long long x = 1;
  for (int j = 0; j < n; ++j) x = x * b % 1000000007;
  printf("%d\n", (int)x);
}
