Let us construct the matrix explicitly. Let $A_n=(a_{ij})$ be $n \times n$ matrix, with $a_{ij}=1$ except for $a_{ii}=0$. E.g.
$$
A_3=
\begin {bmatrix}
0 & 1 & 1\\
1 & 0 & 1\\
1 & 1 & 0\\
\end {bmatrix}$$
We can compute $det(A_n)$ without any explicit computation just by looking at eigenvalues and eigenvectors of $A_n$. It has eignvector $(1, 1, 1, \dots, 1)^T$ with eigenvalue $n-1$ and $n-1$ eigenvectors $v_i : v_{ik} = 0$ except for $v_{i0}=-1$ and $v_{ik} =1$ for $k=n-i+1$. It is obvious that $(v_i)$ are linear independent and thus correspond to different eigenvalues. E.g. for $A_3$ we get $v_1=(-1, 0, 1)^T$ and $v_1=(-1, 1, 0)^T$. All corresponding eigenvalues equal $-1$ so we conclude that $$\det(A_n) = \prod \lambda_i = (-1)^{n-1} \cdot (n-1)$$
So if $n$ is odd you can take $A_n$, and if $n$ is even you should just exchange any two column or rows in $A_n$.