N = int( eval(input()))

S = eval(input())

Q = 10**9+7

A = [1]*26

ANS = [0]*26

for i in range(N):

    s = ord(S[i]) - ord("a")

    ans = 1

    for j in range(26):

        if j != s:

            ans *= A[j]

            ans %= Q

    ANS[j] = (ANS[j] + ans)%Q

    A[s] += 1

print(( sum(ANS)))

from collections import Counter

N = int( eval(input()))

S = eval(input())

Q = 10**9+7

C = Counter(S)

ans = 1

for c in C:

    ans *= C[c]+1

    ans %= Q

print(((ans-1)%Q))

N = int(eval(input()))
S = eval(input())
Q = 10**9 + 7
A = [1] * 26
ANS = [0] * 26
for i in range(N):
    s = ord(S[i]) - ord("a")
    ans = 1
    for j in range(26):
        if j != s:
            ans *= A[j]
            ans %= Q
    ANS[j] = (ANS[j] + ans) % Q
    A[s] += 1
print((sum(ANS)))

from collections import Counter

N = int(eval(input()))
S = eval(input())
Q = 10**9 + 7
C = Counter(S)
ans = 1
for c in C:
    ans *= C[c] + 1
    ans %= Q
print(((ans - 1) % Q))

+from collections import Counter + -A = [1] * 26 -ANS = [0] * 26 -for i in range(N): -    s = ord(S[i]) - ord("a") -    ans = 1 -    for j in range(26): -        if j != s: -            ans *= A[j] -            ans %= Q -    ANS[j] = (ANS[j] + ans) % Q -    A[s] += 1 -print((sum(ANS))) +C = Counter(S) +ans = 1 +for c in C: +    ans *= C[c] + 1 +    ans %= Q +print(((ans - 1) % Q))