#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

string S;
vector<int> aaa;

int main() {
    cin >> S;
    int N = S.length();

    for (int i = 5; i <= 49; i++) {
        aaa.push_back(2019 * i);
    }
    
    ll ans = 0;
    for (int i = 0; i < N-4; i++) {
        string str = S.substr(i, 5);
        int stint = stoi(str);
        for (int j = 0; j < aaa.size(); j++) {
            if (stint == aaa[j]) {
                ans++;
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}