1. An image forming apparatus comprising: a plurality of image forming units that are each configured to be detachably mountable and include an image carrier that is driven to rotate; a light irradiation unit configured to irradiate respective image carriers of the plurality of image forming units with light to form one or more electrostatic latent images along a direction of the rotational driving; a detection unit configured to detect the one or more electrostatic latent images; a determination unit configured to determine mounted states of the plurality of image forming units based on a detection result obtained by the detection unit; and a control unit configured to perform control such that, for each of image carriers, the one or more electrostatic latent images are not formed on an image carrier in a period in which at least one of the one or more electrostatic latent images is formed on a different image carrier.