Coexistence of shell model and deformed states in oxygen isotopes