Citizenship by grant runs on residence. The five years count only while you hold a resident or permanent resident visa, not a work, student or visitor visa.