Adsorption of oxygen and nitrogen on surface-modified carbons