import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    }	
		
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    }	
		
} Main public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    } main {
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc long cnt =0; cnt 0 for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		} long i = 1; long i = 1; i 1 i < N+1 i N+1 N 1 i++ i++ i {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		} {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		} if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			} i%3==0||i%5==0 i%3==0 i%3 i 3 0 i%5==0 i%5 i 5 0 {
				
			} {
				cnt += i;
			} cnt += i cnt i System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    }	
		
} public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    }	
		
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long cnt =0;
		for (long i = 1; i < N+1; i++) {
			if (i%3==0||i%5==0) {
				
			}else{
				cnt += i;
			}
		}
		System.out.println(cnt);
		sc.close();
    }	
		
}