#include<stdio.h>
int main()
{
	int n,a,c=0,i,e;
	scanf("%d",&n);
	if(n%2==0) {a=n/2;
	 for(i=1;a!=0;i++)
	 {e=a%10;
	 c+=e;
	 a/=10;
	 }}
	else {a=n-1;
	 for(i=1;a!=0;i++)
	 {e=a%10;
	 c+=e;
	 a/=10;
	}c+=1;
	}
	printf("%d",c);
	
	
 } 