/**
 * Created by IntelliJ IDEA.
 * User: m09fpv
 * Date: 07.10.2009
 * Time: 18:18:01
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;
public class sum {
    public static void main(String[]  args) throws Exception {
Scanner in=new  Scanner(new File("sum.in"));
PrintWriter out=new PrintWriter(new File("sum.out"));
  int t,m;
    t=0;
   int n=in.nextInt();
    if(n<10){out.print(n);}
      else{
    while(n>10){
       m=n%10;
       n=(n-m)/10;
       t=t+m;
    }
        m=n%10;
        t=t+m;
  out.print(t);
    }
  in.close();
  out.close();
}
}
