A convex polygon has \( n \) sides. The number of diagonals in this polygon is equal to the number of vertices of a triangle plus the number of sides of a quadrilateral. Find the value of \( n \). Let's think step by step and output the final answer within \boxed{}.
user