Transmission spectrum of an optical cavity containing N atoms