#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int minnovca(long long v){
    if(v == 0)
        return 0;
    if(v == 1 || v == 2 || v == 5)
        return 1;
    if(v == 3 || v == 4 || v == 6 || v == 7)
        return 2;
    if(v == 8 || v == 9)
        return 3;}
int main()
{
    long long v;
    cin >> v;

    long long br = 0;
    while(v > 0){
        br += minnovca(v%10);
        v /= 10;
    }
    cout << br;
    return 0;
}