Loss of H and O from Mars: Implications for the planetary water inventory