import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    }

    private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    }

    private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long answer = 0; answer 0 for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            answer += calcFizBuzz(i);
        } {
            answer += calcFizBuzz(i);
        } answer += calcFizBuzz(i) answer calcFizBuzz(i) calcFizBuzz i System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    } calcFizBuzz {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    } int rtn = n; rtn n if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        } ((n % 3) == 0) || ((n % 5) == 0) ((n % 3) == 0) (n % 3) n 3 0 ((n % 5) == 0) (n % 5) n 5 0 {
            rtn = 0;
        } rtn = 0 rtn 0 return rtn; rtn int n n public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    }

    private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    }

    private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long answer = 0;
        for (int i = 1; i <= n; i++) {
            answer += calcFizBuzz(i);
        }
        System.out.println(answer);
        sc.close();
    }

    private static int calcFizBuzz(int n) {
        int rtn = n;
        if (((n % 3) == 0) || ((n % 5) == 0)) {
            rtn = 0;
        }
        return rtn;
    }
}
