import java.io.*;
import java.util.*;

 public class gcd {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new File("sum.in"));
        PrintWriter out = new PrintWriter("sum.out");
        long n=in.nextLong();
        long s = 0;
        while (n>0){
            s=s+n%10;
            n=n/10;
        }
        out.println(s);
        out.close();
    }
 }
