main = do
 [a,b,x] <- map read . words <$> getLine
 print (between a b x)

between a b x
 | ra == 0 && rb == 0 = qb - qa + 1
 | otherwise = qb - qa 
 where
  (qa,ra) = divMod a x
  (qb,rb) = divMod b x