#include <iostream> using namespace std; int main() { int n;cin>>n; int m = 0; m = n/24; int p = n%24; if (p == 0 )cout<<3*m<<endl; else{ if (p ==6 || p==8)cout<<3*m+1<<endl; else if(p == 12 || p==16 || p ==14)cout<<3*m+2<<endl; else if(p == 18 || p ==22 || p==20)cout<<3*m+3<<endl; else cout<<-1<<endl; } } // 64 位输出请用 printf("%lld")