Given a finite metric set $S=\{P_1,\dots,P_n\}$, one gets a real symmetric matrix $M=M(S)$ with rows and columns indexed by elements of $S$ by setting $M_{i,j}=d(P_i,P_j)$. It is easy to see that $M$ has at least one strictly positive and one strictly negative eigenvalue if $S$ contains at least $2$ points. For metric sets of three points, the matrix $M$ has always signature $(1,2)$ (one strictly positive and two strictly negative eigenvalues). (This holds in fact for any symmetric $3\times 3$ matrix with zero diagonal and strictly positive off-diagonal coefficients.) In particular, we have always at least two strictly negative eigenvalues if $n\geq 3$.

It seems quite difficult to have more than one strictly positive eigenvalue if $n$ is small (I have an example with $n=9$).

Given an integer $d\geq 2$, what is the smallest number $n=n(d)$ such that there exists a finite metric space $S$ with $n$ elements giving rise to a matrix $M$ having $d$ non-negative eigenvalues?

So far, all I know is $3< n(2)\leq 9$.

Update: $n(2)=4$, realized by the metric space with two pairs of points $A,B$ and $C,D$ at distance $2$, all other distances between distinct points are $1$. (The corresponding matrix $M$ has eigenvalues $-2,-2,0,4$).

I have an example with five points having two strictly positive eigenvalues.

Other bounds: $n(3)\leq 6$ (my example has however $0$ as an eigenvalue and only for $n=7$ do I have an example with three strictly positive eigenvalues), $n(4)\leq 9$ and $n(5)\leq 12$.