Measurement of total cross sections for neutrino and antineutrino charged-current interactions in hydrogen and neon