Gravitational lensing and the maximum number of images