You are given a string S of length N consisting of lowercase English letters.

Process Q queries of the following two types:

* Type 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)
* Type 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).

Constraints

* N, Q, i_q, l_q, and r_q are integers.
* S is a string consisting of lowercase English letters.
* c_q is a lowercase English letter.
* 1 \leq N \leq 500000
* 1 \leq Q \leq 20000
* |S| = N
* 1 \leq i_q \leq N
* 1 \leq l_q \leq r_q \leq N
* There is at least one query of type 2 in each testcase.

Input

Input is given from Standard Input in the following format:


N
S
Q
Query_1
\vdots
Query_Q


Here, Query_i in the 4-th through (Q+3)-th lines is one of the following:


1 i_q c_q



2 l_q r_q


Output

For each query of type 2, print a line containing the answer.

Example

Input

7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7


Output

3
1
5
//package Qe;

import java.io.*;
import java.util.*;


public class Main {
    private static FastScanner sc = new FastScanner(System.in);
    private static int readInt() {return sc.nextInt();}
    private static String readString() { return sc.nextLine(); }

    
    public static void main(String[] args) {
        int N = readInt();
        String S = readString();

        SegTree[] sts = new SegTree[26];
        for (int i = 0; i<sts.length; i++) {
            sts[i] = new SegTree(N);
        }

        for (int i=0; i<N; i++) {
            sts[S.charAt(i) - 'a'].add(i, 1);
        }

        int Q = readInt();

        char[] ca = S.toCharArray();
        for (int q=0; q<Q; q++) {
            
            String[] qry = readString().split(" ");

            switch (qry[0]) {
                case "1":
                    int I = Integer.parseInt(qry[1]) - 1;
                    char C = qry[2].charAt(0);
                    if (ca[I] != C) {
                        sts[ca[I] - 'a'].add(I, -1);
                        sts[C - 'a'].add(I, 1);
                        ca[I] = C;
                    }
                    break;
                case "2":
                    int L = Integer.parseInt(qry[1])-1;
                    int R = Integer.parseInt(qry[2]);
                    int ans = 0;
                    for (int i = 0; i<sts.length; i++) {
                        if (sts[i].sum(L, R) > 0) ans++;
                    }
                    System.out.println(ans);
                    break;
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String nextLine() {
            String res = "";
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return res;
        }

        String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

    static class SegTree {
        private long[] sg;
        private long[] sg2;
        private int sz;
        private int N;

        public SegTree(int N) {
            this.N = N;
            int sz = 1;
            while (sz < N) {
                sz <<= 1;
            }
            this.sz = sz;
            sg = new long[sz << 1];
            sg2 = new long[sz << 1];
        }

        void add(int i, int j, long X, int v, int l, int r) {
            if (r <= i || j <= l) {
                return;
            }
            if (i <= l && r <= j) {
                sg2[v] += X;
            } else {
                sg[v] += (Math.min(j, r) - Math.max(i, l)) * X;
                int m = (l + r) / 2;
                add(i, j, X, v * 2 + 1, l, m);
                add(i, j, X, v * 2 + 2, m, r);
            }
        }

        void add(int i, long X) {
            add(i, i+1, X, 0, 0, this.sz);
        }

        long sum(int i, int j, int v, int l, int r) {
            if (r <= i || j <= l) {
                return 0L;
            } else if (i <= l && r <= j) {
                return sg[v] + (r - l) * sg2[v];
            } else {
                long base = (Math.min(j, r) - Math.max(i, l)) * sg2[v];
                int m = (l + r) / 2;
                long vl = sum(i, j, v * 2 + 1, l, m);
                long vr = sum(i, j, v * 2 + 2, m, r);
                return base + vl + vr;
            }
        }

        long sum(int i, int j) {
            return sum(i, j, 0, 0, this.sz);
        }
    }
}