But, after the foreclosure, the bank should pay the HOA until it sells it. So, you pay starting the day of settlement.
If the bank has already paid for the month, then you pay the bank for the rest of the month, and pay the HOA starting the next month.