n = int(input())
s = input()
q = int(input())

queris = []
for _ in range(q):
    t, a, b = input().split()
    queris.append((t, a, b))


size = 1
while size < n:
    size *= 2

seg = [0] * (2 * size - 1)

def alph2bit(alph):
    return 1 << (ord(alph) - ord('a'))

def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2]

def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right

for i in range(n):
    update(i, s[i], seg)

for t, a, b in queris:
    if t == '1':
        update(int(a) - 1, b, seg)
    else:
        result = query(int(a) - 1, int(b), 0, 0, size, seg)
        print(bin(result).count('1')) n = int(input()) n int(input()) int input() input s = input() s input() input q = int(input()) q int(input()) int input() input queris = [] queris [] for _ in range(q):
    t, a, b = input().split()
    queris.append((t, a, b)) _ range(q) range q t, a, b = input().split() t input().split() ().split () input split a b queris.append((t, a, b)) queris.append queris append (t, a, b) t a b size = 1 size 1 while size < n:
    size *= 2 size < n size n size *= 2 size 2 seg = [0] * (2 * size - 1) seg [0] * (2 * size - 1) [0] 0 2 * size - 1 2 * size 2 size 1 def alph2bit(alph):
    return 1 << (ord(alph) - ord('a')) alph2bit return 1 << (ord(alph) - ord('a')) 1 << (ord(alph) - ord('a')) 1 ord(alph) - ord('a') ord(alph) ord alph ord('a') ord 'a' alph alph def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] update i += size - 1 i size - 1 size 1 segment_tree[i] = alph2bit(x) segment_tree[i] segment_tree i alph2bit(x) alph2bit x while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] i > 0 i 0 i = (i - 1) // 2 i (i - 1) // 2 i - 1 i 1 2 segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] segment_tree[i] segment_tree i segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] segment_tree[i * 2 + 1] segment_tree i * 2 + 1 i * 2 i 2 1 segment_tree[i * 2 + 2] segment_tree i * 2 + 2 i * 2 i 2 2 i i x x segment_tree segment_tree def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right query if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
     r <= s or t <= l r <= s r s t <= l t l return 0 0 if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right s <= l and r <= t s <= l s l r <= t r t return segment_tree[k] segment_tree[k] segment_tree k ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree) ask_left query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree) query s t k * 2 + 1 k * 2 k 2 1 l (l + r) // 2 l + r l r 2 segment_tree ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree) ask_right query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree) query s t k * 2 + 2 k * 2 k 2 2 (l + r) // 2 l + r l r 2 r segment_tree return ask_left | ask_right ask_left | ask_right ask_left ask_right s s t t k k l l r r segment_tree segment_tree for i in range(n):
    update(i, s[i], seg) i range(n) range n update(i, s[i], seg) update i s[i] s i seg for t, a, b in queris:
    if t == '1':
        update(int(a) - 1, b, seg)
    else:
        result = query(int(a) - 1, int(b), 0, 0, size, seg)
        print(bin(result).count('1')) t a b queris if t == '1':
        update(int(a) - 1, b, seg)
    else:
        result = query(int(a) - 1, int(b), 0, 0, size, seg)
        print(bin(result).count('1')) t == '1' t '1' update(int(a) - 1, b, seg) update int(a) - 1 int(a) int a 1 b seg result = query(int(a) - 1, int(b), 0, 0, size, seg) result query(int(a) - 1, int(b), 0, 0, size, seg) query int(a) - 1 int(a) int a 1 int(b) int b 0 0 size seg print(bin(result).count('1')) print bin(result).count('1') (result).count (result) bin result count '1' size = 1 1 size a, b = input().split() input().split() a b = input().split() input().split() b def alph2bit(alph):
    return 1 << (ord(alph) - ord('a')) def alph2bit(alph):
    return 1 << (ord(alph) - ord('a')) alph2bit def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right query s = input() input() s def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2] update seg = [0] * (2 * size - 1) [0] * (2 * size - 1) seg result = query(int(a) - 1, int(b), 0, 0, size, seg) query(int(a) - 1, int(b), 0, 0, size, seg) result t, a, b = input().split() input().split() t q = int(input()) int(input()) q n = int(input()) int(input()) n queris = [] [] queris size *= 2 2 size
n = int(input())
s = input()
q = int(input())

queris = []
for _ in range(q):
    t, a, b = input().split()
    queris.append((t, a, b))


size = 1
while size < n:
    size *= 2

seg = [0] * (2 * size - 1)

def alph2bit(alph):
    return 1 << (ord(alph) - ord('a'))

def update(i, x, segment_tree):
    i += size - 1
    segment_tree[i] = alph2bit(x)
    while i > 0:
        i = (i - 1) // 2 # 親を更新していく。
        segment_tree[i] = segment_tree[i * 2 + 1] | segment_tree[i * 2 + 2]

def query(s, t, k, l, r, segment_tree):
    if r <= s or t <= l: # 区間が全くかぶらない場合
        return 0
    if s <= l and r <= t: # 求められた区間が、l, rを完全に含んでいる。
        return segment_tree[k]
    else:
        ask_left = query(s, t, k * 2 + 1, l, (l + r) // 2, segment_tree)
        ask_right = query(s, t, k * 2 + 2, (l + r) // 2, r, segment_tree)
        return ask_left | ask_right

for i in range(n):
    update(i, s[i], seg)

for t, a, b in queris:
    if t == '1':
        update(int(a) - 1, b, seg)
    else:
        result = query(int(a) - 1, int(b), 0, 0, size, seg)
        print(bin(result).count('1'))
