output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
attempt: def usage():
      product = 1
      N, P = map(int, input().split())
  
      fct = factorize(P)
  
      for i in range(len(fct)):
          fct[i][1] = fct[i][1] // N
  
          if fct[i][1] >= 1:
              product = product * (fct[i][0] ** fct[i][1])
      print(product)
  
  
  def factorize(n):
      fct = []  # prime factor
      b, e = 2, 0  # base, exponent
      while b * b <= n:
          while n % b == 0:
              n = n // b
              e = e + 1
          if e > 0:
              fct.append([b, e])
          b, e = b + 1, 0
      if n > 1:
          fct.append([n, 1])
      return fct
  
  
  if __name__ == "__main__":
      usage()
  
problem_description: Statement
  
  You are given an integer N that has exactly four digits in base ten. How many
  times does `2` occur in the base-ten representation of N?
samples: [{"input": "1222", "output": "3\n    \n\n`2` occurs three times in `1222`. By the way, this contest is held on December\n22 (JST).\n\n* * *"}, {"input": "3456", "output": "0\n    \n\n* * *"}, {"input": "9592", "output": "1"}]