In general The term middle-income unit means any unit in a building if— (i) such unit is rent-restricted (as defined in subsection (g)(2)), and (ii) the individuals occupying such unit meet the income limitation applicable under subsection (g)(1) to the project of which such building is a part. (B) Exceptions (i) Exclusion of low-income units A unit shall not be treated as a middle-income unit if such unit is a low-income unit (as defined under section 42(i)(3)). (ii) Unit must be suitable for permanent occupancy (I) In general A unit shall not be treated as a middle-income unit unless the unit is suitable for occupancy and used other than on a transient basis. (II) Suitability for occupancy For purposes of subclause (I), the suitability of a unit for occupancy shall be determined under regulations prescribed by the Secretary taking into account local health, safety, and building codes. (III) Single-room occupancy units For purposes of subclause (I), a single-room occupancy unit shall not be treated as used on a transient basis merely because it is rented on a month-by-month basis. (C) Special rule for buildings having 4 or fewer units In the case of any building which has 4 or fewer residential rental units, no unit in such building shall be treated as a middle-income unit if the units in such building are owned by— (i) any individual who occupies a residential unit in such building, or (ii) any person who is related (as defined in subsection (d)(2)(D)(ii)) to such individual. (D) Rules relating to students (i) In general A unit occupied solely by individuals who— (I) have not attained age 24, and (II) are enrolled in a full-time course of study at an institution of higher education (as defined in section 3304(f)), shall not be treated as a middle-income unit. (ii) Exception for certain federal programs In the case of a federally assisted building (as defined in subsection (d)(6)(C)(i) of section 42), clause (i) shall not apply to a unit all of the occupants of which meet all applicable requirements under the