#include <iostream>
using namespace std;
#include <algorithm>
#include<vector>
int main() {
int n,a,b;
cin>>n;
a = n/6;
b = n/8;
int count = 0;
vector<int>L;
for(int i=0;i<=a;i++)
{
for(int j=0;j<=b;j++)
{
if((6*i)+(8*j)==n)
{
L.push_back(i+j);
count++;
}
}
}
if(count == 0)
{
cout<<"-1"<<endl;
}
if(count!=0)
{
sort(L.begin(),L.end());
cout<<L.front();
}
return 0;
}

京公网安备 11010502036488号