output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: import bisect
  import sys
  
  sys.setrecursionlimit(10**9)
  
  
  def main():
      N = int(input())
      S = list(input())
  
      a_ord = ord("a")
      z_ord = ord("z")
  
      set_list = [[] for _ in range(z_ord + 1)]
      for i in range(N):
          s = S[i]
          set_list[ord(s)].append(i)
  
      Q = int(input())
      for q in range(Q):
          ipt = input().split()
          if ipt[0] == "1":
              i, c = int(ipt[1]), ipt[2]
              j = ord(S[i - 1])
  
              if j == ord(c):
                  continue
              set_list[j].remove(i - 1)
              bisect.insort_left(set_list[ord(c)], i - 1)
              S[i - 1] = c
              # print(set_list[])
  
          else:
              l, r = int(ipt[1]), int(ipt[2])
              ans = 0
              # if l == r:
              #     print(1)
              #     continue
  
              for i in range(a_ord, z_ord + 1):
                  st = set_list[i]
                  if not len(st) > 0:
                      continue
  
                  # print(i,set_list[i])
                  l_p = bisect.bisect_left(st, l - 1)
                  r_p = bisect.bisect_right(st, r - 1)
  
                  # print(l-1,r-1,l_p,r_p)
                  if l_p < r_p:
                      ans += 1
  
              # print(ans,"____")
              print(ans)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  Takahashi wants to print a document with N pages double-sided, where two pages
  of data can be printed on one sheet of paper.
  
  At least how many sheets of paper does he need?
samples: [{"input": "5", "output": "3\n    \n\nBy printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the\n2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3\nsheets of paper.\n\n* * *"}, {"input": "2", "output": "1\n    \n\n* * *"}, {"input": "100", "output": "50"}]