Call the given grid "Grid A". Consider Grid B, where the vertices of Grid B fall in the centers of the squares of Grid A; thus, Grid B has dimensions $(n-1) \times (n-1)$. There is a one-to-one correspondence between the edges of Grid B and the number of adjacent pairs of unit squares in Grid A. The number of edges in Grid B is $2n(n-1)$, and the number of ways to pick two squares out of Grid A is $\dbinom{n^2}{2}$. So, the probability that the two chosen squares are adjacent is $\frac{2n(n-1)}{\binom{n^2}{2}} = \frac{2n(n-1)}{\frac{n^2(n^2-1)}{2}} = \frac{4}{n(n+1)}$. We wish to find the smallest positive integer $n$ such that $\frac{4}{n(n+1)} < \frac{1}{2015}$, and by inspection the first such $n$ is $\boxed{090}$.
Two unit squares are selected at random without replacement from an $n \times n$ grid of unit squares. Find the least positive integer $n$ such that the probability that the two selected unit squares are horizontally or vertically adjacent is less than $\frac{1}{2015}$.