Make n the subject of the formula

M=3n+z

M-z = 3n

(M-z)/3 = n