The lone pair of electrons can be identified by drawing structure of the given moleules as follows,

The number of molecules having only 2 lone pair of electrons =3
Which are H2O,N2 and CO. XeF4 have 2 lone pairs on central atom, but we are asked about lone pair in molecule