The three sides of a triangle are z+9, z+1, and z+2. If the perimeter of the triangle is 48, what is the value of z?