n = int(input())
s = list(input())
s = [ord(i)-97 for i in s]

dic = {}
for i in range(26):
    dic[i] = []

for i in range(n):
    dic[s[i]].append(i)

for i in range(26):
    dic[i].append(float('inf'))

from bisect import bisect_left
q = int(input())
for i in range(q):
    x, y, z = input().split()
    if x == '1':
        y, z = int(y) - 1, ord(z) - 97
        p = bisect_left(dic[s[y]], y)
        dic[s[y]].pop(p)
        dic[z].insert(bisect_left(dic[z], y), y)
        s[y] = z
    else:
        res = 0
        y, z = int(y) - 1, int(z) - 1
        for i in range(26):
            p = dic[i][bisect_left(dic[i], y)]
            if p <= z:
                res += 1
        print(res) n = int(input()) n int(input()) int input() input s = list(input()) s list(input()) list input() input ord(i)-97 for i in s for i in s i s for i in s ord(i)-97 ord(i) ord i 97 s = [ord(i)-97 for i in s] s [ord(i)-97 for i in s] dic = {} dic {} for i in range(26):
    dic[i] = [] i range(26) range 26 dic[i] = [] dic[i] dic i [] for i in range(n):
    dic[s[i]].append(i) i range(n) range n dic[s[i]].append(i) [s[i]].append [s[i]] dic s[i] s i append i for i in range(26):
    dic[i].append(float('inf')) i range(26) range 26 dic[i].append(float('inf')) [i].append [i] dic i append float('inf') float 'inf' from bisect import bisect_left q = int(input()) q int(input()) int input() input for i in range(q):
    x, y, z = input().split()
    if x == '1':
        y, z = int(y) - 1, ord(z) - 97
        p = bisect_left(dic[s[y]], y)
        dic[s[y]].pop(p)
        dic[z].insert(bisect_left(dic[z], y), y)
        s[y] = z
    else:
        res = 0
        y, z = int(y) - 1, int(z) - 1
        for i in range(26):
            p = dic[i][bisect_left(dic[i], y)]
            if p <= z:
                res += 1
        print(res) i range(q) range q x, y, z = input().split() x input().split() ().split () input split y z if x == '1':
        y, z = int(y) - 1, ord(z) - 97
        p = bisect_left(dic[s[y]], y)
        dic[s[y]].pop(p)
        dic[z].insert(bisect_left(dic[z], y), y)
        s[y] = z
    else:
        res = 0
        y, z = int(y) - 1, int(z) - 1
        for i in range(26):
            p = dic[i][bisect_left(dic[i], y)]
            if p <= z:
                res += 1
        print(res) x == '1' x '1' y, z = int(y) - 1, ord(z) - 97 y int(y) - 1 int(y) int y 1 z ord(z) - 97 ord(z) ord z 97 p = bisect_left(dic[s[y]], y) p bisect_left(dic[s[y]], y) bisect_left dic[s[y]] dic s[y] s y y dic[s[y]].pop(p) [s[y]].pop [s[y]] dic s[y] s y pop p dic[z].insert(bisect_left(dic[z], y), y) [z].insert [z] dic z insert bisect_left(dic[z], y) bisect_left dic[z] dic z y y s[y] = z s[y] s y z res = 0 res 0 y, z = int(y) - 1, int(z) - 1 y int(y) - 1 int(y) int y 1 z int(z) - 1 int(z) int z 1 for i in range(26):
            p = dic[i][bisect_left(dic[i], y)]
            if p <= z:
                res += 1
         i range(26) range 26 p = dic[i][bisect_left(dic[i], y)] p dic[i][bisect_left(dic[i], y)] [i] dic i bisect_left(dic[i], y) bisect_left dic[i] dic i y if p <= z:
                res += 1
         p <= z p z res += 1 res 1 print(res) print res z = int(y) - 1, ord(z) - 97 ord(z) - 97 z y, z = int(y) - 1, ord(z) - 97 int(y) - 1 y z = int(y) - 1, int(z) - 1 int(z) - 1 z res += 1 1 res z = input().split() input().split() z dic = {} {} dic x, y, z = input().split() input().split() x s = list(input()) list(input()) s p = dic[i][bisect_left(dic[i], y)] dic[i][bisect_left(dic[i], y)] p n = int(input()) int(input()) n q = int(input()) int(input()) q y, z = input().split() input().split() y y, z = int(y) - 1, int(z) - 1 int(y) - 1 y p = bisect_left(dic[s[y]], y) bisect_left(dic[s[y]], y) p s = [ord(i)-97 for i in s] [ord(i)-97 for i in s] s res = 0 0 res
n = int(input())
s = list(input())
s = [ord(i)-97 for i in s]

dic = {}
for i in range(26):
    dic[i] = []

for i in range(n):
    dic[s[i]].append(i)

for i in range(26):
    dic[i].append(float('inf'))

from bisect import bisect_left
q = int(input())
for i in range(q):
    x, y, z = input().split()
    if x == '1':
        y, z = int(y) - 1, ord(z) - 97
        p = bisect_left(dic[s[y]], y)
        dic[s[y]].pop(p)
        dic[z].insert(bisect_left(dic[z], y), y)
        s[y] = z
    else:
        res = 0
        y, z = int(y) - 1, int(z) - 1
        for i in range(26):
            p = dic[i][bisect_left(dic[i], y)]
            if p <= z:
                res += 1
        print(res)