Ultrahigh-resolution two-photon optical Ramsey spectroscopy of an atomic fountain