import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Debug.Trace

main :: IO ()
main = readLn >>= print . solve

solve :: Int -> Int
solve n = foldl' count 0 [1..s]
    where
        s = truncate . sqrt $ fromIntegral n

        count acc r
            | b == 0 && r < a - 1 = acc + a - 1
            | otherwise = acc
            where
                (a, b) = n `divMod` r

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine