#include<bits/stdc++.h>


using namespace std;

int main()
{
int t,i,p = 0,a,b;

cin >> t;

char n[30];


getchar();

for(i = 0;i < t;i++) {
    n[i] = getchar();
    getchar();
}

for(a = n[t - 1];t <= 0;t--) {
    b++;
    if(b > 9) {
        p = b;
        b = 0;
        p += b;
    }
}
cout << p;






}