#include using namespace std; int n,m; int main(){ cin >> n; m += n/500; if ((n%500) > 100) { m++; } cout << m << endl; return 0; }