this section may not exceed 25 percent of the number of low-income communities in the State. (2) Exception If the number of low-income communities in a State is less than 100, then a total of 25 of such tracts may be designated as qualified opportunity zones. (f) Designation of tracts contiguous with low-Income communities (1) In general A population census tract that is not a low-income community may be designated as a qualified opportunity zone under this section if— (A) the tract is contiguous with the low-income community that is designated as a qualified opportunity zone, and (B) the median family income of the tract does not exceed 125 percent of the median family income of the low-income community with which the tract is contiguous. (2) Limitation Not more than 5 percent of the population census tracts designated in a State as a qualified opportunity zone may be designated under paragraph (1). (g) Period for which designation is in effect A designation as a qualified opportunity zone shall remain in effect for the period beginning on the date of the designation and ending at the close of the 10th calendar year beginning on or after such date of designation. 1400Z–2. Deferral for capital gains invested in opportunity zones (a) Special rules when gain from sale of property invested in opportunity zone property (1) Exclusion of gain invested in opportunity zone property In the case of gain from the sale to, or exchange with, an unrelated person of any property held by the taxpayer, at the election of the taxpayer— (A) gross income for the taxable year shall not include so much of such gain as does not exceed the aggregate cost of all qualified opportunity zone property acquired by the taxpayer during the 180-day period beginning on the date of such sale or exchange, and (B) the amount of gain excluded by subparagraph (A) shall be included in gross income as provided by paragraph (2). (2) Deferral of gain invested in opportunity zone property (A) Year of inclusion Except as provided by subparagraph (C), gain