http://ybt.ssoier.cn:8088/problem_show.php?pid=1982
/*
1982:【19CSPJ普及组】数字游戏03
http://ybt.ssoier.cn:8088/problem_show.php?pid=1982
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
//一个数的各位数字之和等于这个数%9的值
//能被9整除的数的特征:各个数位上的数字和能被9整除,那么这个数能被9整除。
int f;
cin>>f;
cout<<f%9;
return 0;
}