A subset of the real numbers has the property that for any two distinct elements of it such as $x$ and $y$, we have $(x+y-1)^2 = xy+1$. What is the maximum number of elements in this set?

$\textbf{(A)}\ 1\qquad\textbf{(B)}\ 2\qquad\textbf{(C)}\ 3\qquad\textbf{(D)}\ 4\qquad\textbf{(E)}\ \text{Infinity}$
1. Given the equation \((x + y - 1)^2 = xy + 1\), we start by expanding and simplifying it.
   \[
   (x + y - 1)^2 = x^2 + y^2 + 2xy - 2x - 2y + 1
   \]
   \[
   xy + 1 = xy + 1
   \]
   Equating both sides, we get:
   \[
   x^2 + y^2 + 2xy - 2x - 2y + 1 = xy + 1
   \]
   Simplifying further:
   \[
   x^2 + y^2 + xy - 2x - 2y = 0
   \]

2. Rearrange the equation to form a quadratic in \(x\):
   \[
   x^2 + (y - 2)x + (y^2 - 2y) = 0
   \]
   This is a quadratic equation in \(x\) with coefficients dependent on \(y\).

3. To find the roots of this quadratic equation, we use the quadratic formula \(x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\), where \(a = 1\), \(b = y - 2\), and \(c = y^2 - 2y\):
   \[
   x = \frac{-(y - 2) \pm \sqrt{(y - 2)^2 - 4(y^2 - 2y)}}{2}
   \]
   Simplify the discriminant:
   \[
   (y - 2)^2 - 4(y^2 - 2y) = y^2 - 4y + 4 - 4y^2 + 8y = -3y^2 + 4y + 4
   \]
   Thus, the roots are:
   \[
   x = \frac{2 - y \pm \sqrt{-3y^2 + 4y + 4}}{2}
   \]

4. For the quadratic equation to have real roots, the discriminant must be non-negative:
   \[
   -3y^2 + 4y + 4 \geq 0
   \]
   Solving this inequality, we find the range of \(y\) for which the discriminant is non-negative.

5. We need to ensure that the set of numbers \(x_1, y_1, 2 - y_1 - x_1\) forms a valid subset. By Vieta's formulas, if \(x_1\) and \(y_1\) are roots of the quadratic equation, then \(2 - y_1 - x_1\) must also be a root.

6. We check if adding more elements to the set would still satisfy the given condition. If we add another element, say \(z\), we need to ensure that \((x + z - 1)^2 = xz + 1\) and \((y + z - 1)^2 = yz + 1\) hold true for all pairs \((x, y, z)\) in the set.

7. By examining the relationships and ensuring all conditions are met, we find that the maximum number of elements in the set is 3, as adding a fourth element would violate the given condition.

The final answer is \(\boxed{3}\).