#include <iostream>
  
  struct N {
      int v;
  }

passed by value )
int c(int n){
    if(n<0) return-1; 
    int s=0
    while(n.0)
    s+= n% 10;
    n/-10
}
     return s;
}
int main () {
    
    N d;
    std::cin>>d.v;
    
    int r=c(d.v)
    
    if (r==-1) {
        std:: count<<"invalid input\n";
    }else {
        std::count<<r<< "\n";
    }    
    retun 0;
    }