n = int(input()) a, b, c = n // 3, n // 5, n // 15 print((a - c) * 2 + (b - c) * 2 + c * 4)