#include <bits/stdc++.h>
using int_t = long long int;
constexpr int_t mod = 1000000007;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int_t n;
  std::string s;
  std::cin >> n >> s;
  std::vector<int_t> a(n + 1);
  a.front() = 1;
  std::vector<int_t> pre(26 * (n + 1));
  for (char ch : s) {
    for (int_t i = 0; i < n; ++i) {
      a[i + 1] += a[i] - pre[(ch - 'a') * (n + 1) + i];
      a[i + 1] = (a[i + 1] % mod + mod) % mod;
    }
    std::copy(a.begin(), a.end(), pre.begin() + (ch - 'a') * (n + 1));
  }
  std::cout << a[n] << '\n';
  return 0;
}
