import sys n=int(input()) a=list(range(n+1)) a[1]=0 i=2 while i**2<=n: j=i+i while j<=n: a[j]=0 j+=i i+=1 list=[] for i in a: if i!=0: list.append(i) def fun(sum,index,target,count): if sum==target: print(count) sys.exit() return if index==len(list) or sum>target: return fun(sum+list[index],index+1,target,count+1) fun(sum,index+1,target,count) print(fun(0,0,n,0))