if __name__ == "__main__":
    n = int(input())

    sum_ = 0

    for i in range(n):
        num = i + 1
        if num % 3 == 0 or num % 5 == 0:
            continue
        else:
            sum_ += num

    print(sum_)
