
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Data.Maybe

--notFizzBuzz :: Int -> Int
--notFizzBuzz 

main :: IO ()
main = do 
    n <- fst . fromJust <$> ( BS.readInt <$> BS.getLine ) :: IO Int
    --cs <- getLine
    let f = (\x -> if mod x 3 == 0 || mod x 5 == 0 then 0 else x)
    let notFizzBuzz =  map f [1..n]
    print $ sum notFizzBuzz

