import java.util.*;

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

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long account=0;
        long account2=0;
        
        for(int i=0;i<N;i++){
            account+=1;
            if(account%15==0){
                account2-=account;
            }else if(account%5==0){
                account2-=account;
            }else if(account%3==0){
                account2-=account;
            }
            account2+=account;
        }
        System.out.println(account2);
    }
}