#include using namespace std; int main(){ int n; cin>>n; int ans=n/500; n%=500; if (n>=100) ans++; cout<