Long-range configuration interaction of ionic and covalent states