5. On the plane, there are $n$ points, among which any three points are the vertices of some equilateral triangle. Then the maximum value of $n$ is ( ).
(A) 3
(B) 4
(C) 6
(D) greater than 6
Among the $n$ points that meet the conditions, there must be two points with the greatest distance, let these two points be $A$ and $B$. Then there is a third point $C$, such that $\triangle ABC$ is an equilateral triangle, and the $n$ points are all within the curvilinear triangle in Figure 3 (the curvilinear triangle is formed by drawing arcs with $A$, $B$, and $C$ as centers and $AB$ as the radius). If there is a fourth point $P$, we can assume $P$ is inside $\triangle ABC$, then there is another point $P'$, such that $\triangle APP'$ is an equilateral triangle, and $P'$ must be within one of the segments. There is yet another point $P''$, such that $\triangle CP'P''$ is an equilateral triangle. Now we discuss the position of $P''$. If $P''$ and $A$ are on the same side of $CP'$, then by $\angle P'BC = \angle P''AC > 60^{\circ}$, we know that $P''$ is outside the curvilinear triangle, leading to a contradiction; if $P''$ and $B$ are on the same side of $CP'$, the same contradiction arises where $P''$ is outside the curvilinear triangle. Therefore, $P$, $P'$, and $P''$ cannot all exist, so there can be at most three points.