This is a contest problem from the AMC 12, a mathematical contest for 12th grade students in the United States.

Given a nine-sided regular polygon, how many distinct equilateral triangles in the plane of the polygon have at least two vertices on the polygon?

This GeoGebra applet can be used to visualize the problem. Can you find the solution?