Beatriz started with 16 pencils and gave away x pencils. Ella started with 36 pencils and gave away three times as many pencils as Beatriz did.

How many pencils did Beatriz give away, given they had the same number of pencils left?