#include <iostream>
using namespace std;
const int N = 100 + 10;
int n, res, f[N];
int main() {
cin >> n;
for (int i = 0; i <= 7; i++ ) f[i] = N;
f[6] = 1;
f[8] = 1;
if (n > 8) {
for (int i = 9; i <= n; i++ ) {
int t = min(f[i - 6], f[i - 8]);
if (t != N ) f[i] = t + 1;
else f[i] = N;
}
}
res = f[n] != N ? f[n] : -1;
cout << res << endl;
}



京公网安备 11010502036488号