#include <stdio.h>


int main() {
  short input, output = 0;
  scanf("%hd", &input);

  for (short i = 1; i <= input; i += 1) {
    // incase Fizz
    if (i % 3 == 0) {
      continue;
    }
    // incase Buzz
    if (i % 5 == 0) {
      continue;
    }
    output = output + i;
  }

  printf("%hd\n", output);
}