#include <stdio.h>

int main() {
    int N;
    scanf("%d",&N);

    int three, five = N/5;
    while(five!=-1) {
        if( (N-five*5)%3 == 0 ) {
            three = (N-five*5)/3;
            printf("%d\n",three+five);
            return 0;
        }
        five--;
    }

    printf("-1\n");

    return 0;
}