import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner1 = new Scanner(System.in);
int three, five;
int num = scanner1.nextInt();
five = num / 5;
three = num % 5 / 3;
if (num == (five * 5) + (three * 3))
System.out.println(five + three);
else {
while (num != (five * 5) + (three * 3)) {
five--;
int temp = num;
temp -= (five * 5);
if (five > 0)
three = temp / 3;
else
three = temp / 3;
}
if((five<0) || (three <0))
System.out.println("-1");
else
System.out.println(three+five);
}
}
}