How to remove interior faces while keeping exterior faces untouched?

Thank you very much for helping me with this. Been trying to figure out how to check the four elements.