AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.

The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code.

How many different PIN codes can he set this way?

Both the lucky number and the PIN code may begin with a 0.

Constraints

* 4 \leq N \leq 30000
* S is a string of length N consisting of digits.

Input

Input is given from Standard Input in the following format:


N
S


Output

Print the number of different PIN codes Takahashi can set.

Examples

Input

4
0224


Output

3


Input

6
123123


Output

17


Input

19
3141592653589793238


Output

329
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int c = 0;
        for(int i=0; i<1000; i++) {
            String temp = Integer.toString(i);
            int len = temp.length();
            if(len < 3) {
                temp = (len==1 ? "00" : "0") + temp;
            }
            char t1 = temp.charAt(0);
            char t2 = temp.charAt(1);
            char t3 = temp.charAt(2);
            int i1 = s.indexOf(t1, 0);
            if(i1<0) {
                continue;
            }
            int i2 = s.indexOf(t2, i1+1);
            if(i2<0) {
                continue;
            }
            if(s.indexOf(t3, i2+1)>0) {
                c++;
            }
        }

        System.out.println(c);
    }
}
