#include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;

    for (int i = n / 5; i >= 0; i--) {
        int cnt = n - i * 5;

        if (cnt % 3 == 0) {
            cout << i + cnt / 3;
            return 0;
        }
    }

    cout << -1;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: