#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int i,j;
int totalweight;
cin>>totalweight;
int five,three,other = 0;
if(totalweight>=5){
five = totalweight/5;
other = totalweight%5;
}else{
five = 0;
other = totalweight;
}
if(other%3!=0){
cout<<-1;
}
else{
three = other/3;
cout<<five+three;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKXsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKDApOwogICAgaW50IGksajsKICAgIGludCB0b3RhbHdlaWdodDsKICAgIGNpbj4+dG90YWx3ZWlnaHQ7CiAgICBpbnQgZml2ZSx0aHJlZSxvdGhlciA9IDA7CiAgICBpZih0b3RhbHdlaWdodD49NSl7CiAgICAJZml2ZSA9IHRvdGFsd2VpZ2h0LzU7CgkJb3RoZXIgPSB0b3RhbHdlaWdodCU1OwogICAgfWVsc2V7CiAgICAJZml2ZSA9IDA7CiAgICAJb3RoZXIgPSB0b3RhbHdlaWdodDsKICAgIH0KICAgIGlmKG90aGVyJTMhPTApewogICAgCWNvdXQ8PC0xOwogICAgfQogICAgZWxzZXsKICAgIAl0aHJlZSA9IG90aGVyLzM7CiAgICAJY291dDw8Zml2ZSt0aHJlZTsKICAgIH0KICAgIHJldHVybiAwOwp9