Seven months unless your new coverage is provided by Medicare. In that case, it would be six months. You are eligible to contribute for each month you were covered by an HSA on the first of the month as long as you did not have Medicare for that month.
Just to add on, because I saw your other post regarding the TurboTax instructions. I also saw this and double-checked the Internal Revenue Code.
The only exception listed to the first of the month rule was for Medicare-eligible individuals.
[Edited 03/25/22 | 10:48 AM PST] @pmeyerk1