#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  string a;
  int count = 1;


  for (int i = 1; i < S.size()-3; i++) {
    a = to_string(2019*i);
    if (S.find(a) >= 0) {
      count++;
    }
  }
  cout << count << endl;
}