Problem:
Score : 200 points

Problem Statement

You are given a string S of length N.
Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.

Here, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.

Constraints

1 \leq N \leq 100000

S consists of lowercase English letters.

|S|=N

Input

Input is given from Standard Input in the following format:

N
S

Output

Print the number of the subsequences such that all characters are different, modulo 10^9+7.

Sample Input 1

4
abcd

Sample Output 1

15

Since all characters in S itself are different, all its subsequences satisfy the condition.

Sample Input 2

3
baa

Sample Output 2

5

The answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.

Sample Input 3

5
abcab

Sample Output 3

17

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

/*
連続する部分文字列と思った
fn check(sum: &Vec<Vec<u64>>, front: usize, back: usize) -> bool {
    for i in 0..26 {
        if sum[back][i] - sum[front][i] > 1 {
            return false;
        }
    }
    return true;
}
fn main() {
    input! {
        n: usize,
        s: chars,
    }

    let mut sum = vec![vec![0; 26]; n + 1];

    for i in 0..n {
        sum[i + 1] = sum[i].clone();
        sum[i + 1][(s[i] as u8 - 'a' as u8) as usize] += 1;
    }
    for i in 0..n {
        let mut ok = i as i64;
        let mut ng = n as i64;
        while (ng - ok).abs() > 1 {
            let mid = (ok + ng) / 2;
            if check(&sum, i, mid as usize) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        println!("{} {}", i, ok as usize - i + 1);
    }
    println!("{:?}", sum);
}
*/

fn main() {
    input! {
        n: usize,
        s: chars,
    }

    let mut cnt = vec![0; 26];
    for i in 0..n {
        cnt[(s[i] as u8 - 'a' as u8) as usize] += 1;
    }

    let mut ans = 1;
    for e in cnt {
        ans *= e + 1;
        ans %= 1_000_000_007;
    }
    ans -= 1;
    ans %= 1_000_000_007;

    println!("{}", ans);
}