401k, IRA and HSA contributions will reduce taxable income. You can only contribute to 401k and IRA to the extent that you have earned income, so if you're saying you'll have $6400 of total income for the year then you won't be able to max both, but if that's per month starting in April then you should be fine.
Capital gains stack on top of earned income, and anything under $38,600 for a single filer will be taxed at 0%
So, if you're saying you'll be earning $6400/month with the first paycheck in april (so 9 months of earnings), that could look like this:
$57600 earnings
-$18500 401k contribution
-$3450 HSA contribution
-$5500 IRA contribtion
-$12000 standard deduction
=$18,150 taxable earned income
Which would leave you with $38600 - $18150 = $20450 of in capital gains you could realize in in the 0% bracket. If 50% of your taxable holdings are gains (20k gains on 40k assets) then you could sell 20450/0.5 = $40900 worth of assets.
Remember to also subtract other deductions like health insurance from, and add other income like interest and dividends to your earned income.
Also note that you're within range of the
Saver's Tax Credit, which could be worth as much as $1000 (non refundable, so might be less if your tax due is less), which you would give up if your capital gains push you over the limit, in which case your capital gains rate wouldn't really be 0% since it would be causing you to pay the amount you would otherwise get from the credit.