Advice needed, notice period in Ticino

Today I gave 3 months' notice to the landlord who swiftly pointed out that I can move out on 31.07 at the earliest, as stipulated in the contract. Hence, I need to find a Nachmieter, i.e. a substitute/replacement tenant. Thing is, I am actually leaving the country, so this complicates things quite a bit. I am currently based in Ticino. I am f*ucked, aren't I?