f=input; n=int(f()); s=list(f())
d={chr(97+i):[0]*(n+1) for i in range(26)}
def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s
def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i
for i in range(n): badd(s[i],i+1,1)
for i in range(int(f())):
  a,b,c=f().split(); b=int(b)-1
  if a>'1': print(sum(1 for k in d.keys() if bsum(k,int(c))-bsum(k,b)))
  else: badd(s[b],b+1,-1); s[b]=c; badd(c,b+1,1) f=input f input n=int(f()) n int(f()) int f() f s=list(f()) s list(f()) list f() f chr(97+i):[0]*(n+1) for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(97+i) chr 97+i 97 i [0]*(n+1) [0] 0 n+1 n 1 d={chr(97+i):[0]*(n+1) for i in range(26)} d {chr(97+i):[0]*(n+1) for i in range(26)} def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s bsum s=0 s 0 while i: s+=d[k][i]; i-=i&-i
   i return s s k k i i def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i badd while i<=n: d[k][i]+=x; i+=i& i<=n i n k k i i x x for i in range(n): badd(s[i],i+1,1) i range(n) range n for i in range(int(f())):
  a,b,c=f().split(); b=int(b)-1
  if a>'1': print(sum(1 for k in d.keys() if bsum(k,int(c))-bsum(k,b)))
  else: badd(s[b],b+1,-1); s[b]=c; badd(c,b+1,1) i range(int(f())) range int(f()) int f() f a,b,c=f().split() a f().split() ().split () f split b c b=int(b)-1 b int(b)-1 int(b) int b 1 if a>'1': print(sum(1 for k in d.keys() if bsum(k,int(c))-bsum(k,b)))
  else: badd(s[b],b+1,-1); s[b]=c; badd(c,b+1,1) a>'1' a '1' s=list(f()) list(f()) s n=int(f()) int(f()) n c=f().split() f().split() c def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s bsum a,b,c=f().split() f().split() a b,c=f().split() f().split() b f=input input f def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i badd d={chr(97+i):[0]*(n+1) for i in range(26)} {chr(97+i):[0]*(n+1) for i in range(26)} d b=int(b)-1 int(b)-1 b
f=input; n=int(f()); s=list(f())
d={chr(97+i):[0]*(n+1) for i in range(26)}
def bsum(k,i):
  s=0
  while i: s+=d[k][i]; i-=i&-i
  return s
def badd(k,i,x):
  while i<=n: d[k][i]+=x; i+=i&-i
for i in range(n): badd(s[i],i+1,1)
for i in range(int(f())):
  a,b,c=f().split(); b=int(b)-1
  if a>'1': print(sum(1 for k in d.keys() if bsum(k,int(c))-bsum(k,b)))
  else: badd(s[b],b+1,-1); s[b]=c; badd(c,b+1,1)