#include <stdio.h> int sum(int x) { int result = 0; while(x > 0) { result += x % 10; x /= 10; } return result; } int main() { int x; scanf("%d", &x); printf("%d", sum(x)); return 0; }