The masses of 18 pairs of double neutron stars and implications for their origin