Draw all of the diagonals in a convex *n*-sided polygon. Assuming
that no three diagonals pass through the same point, what is the total
number of triangles that are formed?

For example, there are 8 triangles formed when the diagonals are drawn in a square as shown in the figure below.