import Data.List
main :: IO()
main = do
  _ <- getLine
  v <- map read . words <$> getLine
  c <- map read . words <$> getLine
  print $ slv v c

slv :: [Integer] -> [Integer] -> Integer
slv v c = sum $ dropWhile (<0) $ sort $ map (\(x, y) -> x - y) $ zip v c