import java.util.*;


class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    long rtn = 0;

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

    while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    }
    System.out.println(rtn);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    long rtn = 0;

    while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    }
    System.out.println(rtn);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    long rtn = 0;

    while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    }
    System.out.println(rtn);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int i = 1; i 1 long rtn = 0; rtn 0 while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    } i <= n i n {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    } if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      } i % 3 == 0 || i % 5 == 0 i % 3 == 0 i % 3 i 3 0 i % 5 == 0 i % 5 i 5 0 {
        i++;
      } i++ i {
        rtn += i;
        i++;
      } rtn += i rtn i i++ i System.out.println(rtn) System.out.println System.out System System.out rtn String[] args args
import java.util.*;


class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    long rtn = 0;

    while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    }
    System.out.println(rtn);
  }
}