For an integer n≥3n \geq 3, let M\mathcal{M} be the set {(x,y)∣x,y∈Z,1≤x≤n,1≤y≤n}\{(x, y) \mid x, y \in \mathbb{Z}, 1 \leq x \leq n, 1 \leq y \leq n\} of points in the plane. (Z\mathbb{Z} is the set of integers.)

What is the maximum possible number of points in a subset S⊆MS \subseteq \mathcal{M} which does not contain three distinct points being the vertices of a right triangle?