#include<stdio.h>

int main(void) {
    int i, n, a, b, c, d = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        a = i + 1;
        b = a % 3;
        c = a % 5;
        if (b == 0 || c == 0) {
            a = 0;
        }
        d += a;
    }
    printf("%d\n", d);
    return 0;
}