import           Control.Monad
import           Data.Array
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe
import           Data.Ord

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

main = do
  (n:_) <- readInts
  print $ solve n

solve n = foldl' (+) 0 (zipWith' mod nums mods)
  where
    nums = [1 .. n]
    mods = tail nums ++ [1]

zipWith' f (a:as) (b:bs) = x `seq` x : zipWith' f as bs
  where
    x = f a b
zipWith' _ _ _ = []