Relativistic calculation of spectra of 2-2 transitions in O- and F-like atomic ions