As per CIC:
To keep your status as a permanent resident, you must live in Canada for at least two years within a five-year period i.e minimum of 730 days physical presence in Canada at the 5-year mark.
"To become Canadian citizens, adults must have lived in Canada for at least three years (1,095 days) in the past four years before applying. Children under the age of 18 do not need to meet this requirement.
You may be able to count time you spent in Canada before you became a permanent resident if that time falls within the four-year period."