from collections import Counter

N=int(eval(input()))

S=eval(input())

mod = 10**9+7

d = Counter(S)

ans = 0

for i in S:

    tmp = 1

    d[i] -=1

    for k,v in list(d.items()):

        if i!=k and v:

            tmp *=(v+1)

            tmp%=mod

    ans += tmp

    ans %=mod

print(ans)
from collections import Counter

N=int(eval(input()))

S=eval(input())

mod = 10**9+7

d = Counter(S)

ans = 1

for v in list(d.values()):

    ans *= v+1

    ans %=mod

print((ans-1))
from collections import Counter

N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
d = Counter(S)
ans = 0
for i in S:
    tmp = 1
    d[i] -= 1
    for k, v in list(d.items()):
        if i != k and v:
            tmp *= v + 1
            tmp %= mod
    ans += tmp
    ans %= mod
print(ans)

from collections import Counter

N = int(eval(input()))
S = eval(input())
mod = 10**9 + 7
d = Counter(S)
ans = 1
for v in list(d.values()):
    ans *= v + 1
    ans %= mod
print((ans - 1))

-ans = 0 -for i in S: -    tmp = 1 -    d[i] -= 1 -    for k, v in list(d.items()): -        if i != k and v: -            tmp *= v + 1 -            tmp %= mod -    ans += tmp +ans = 1 +for v in list(d.values()): +    ans *= v + 1 -print(ans) +print((ans - 1))