For the same f-number, the longer the focal length of the lens the more light it lets in from an object - but that is exactly offset by the area of the image of the object, so more light is let in but it has to cover a larger area. The end result is that the brightness of the image of an object at the film or sensor is the same for any focal length of lens at the same f-number, if the slight losses in the lens are ignored.
An exception to this rule is for images of true points of light, like stars. If they are focused to what is effectively a single point then the brightness depends on the actual diameter of the aperture (the entrance pupil, to be accurate), not the relative aperture. Therefore a star picture taken with a 210 mm lens at f/5.6 is brighter than one taken with a 21 mm lens at f/5.6, for example.
Best,
Helen