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?
N=list(input())
c=0
for i in N:
  if i==2 :
    c+=1
print(c)
N=list(input())
c=0
for i in N:
  if i=='2':
    c+=1
print(c)