import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        res i = new res(scan.nextInt());
        System.out.println(i.result());
    }
}
class res{
    private int n;
    res(int n){
        this.n = n;
    }
    public int result(){
        int ans = n%10+n/10%10+n/100%10+n/1000;
        return ans;
    }
}