s=input() l=[[20104,20063,19892,20011,19874,20199,19898,20163,19956,19841][i]-s.count(i)for i in "0123456789"] x=l.index print(x(-1),x(1))