4. For a finite arithmetic sequence $\left\{a_{n}\right\}$ with the first term $a_{1}=1$ and a common difference of 2, the arithmetic mean of all its terms is 2015. If one term is deleted, the arithmetic mean of the remaining terms is an integer. Then the number of ways to delete a term is $\qquad$.
4. 3 .

According to the problem, we have $\frac{1}{n}\left(n+\frac{n(n-1)}{2} \times 2\right)=2015$, solving this gives $n=2015$, thus the sum of all terms in the sequence is $2015^{2}$.

Suppose the arithmetic mean of the remaining terms after deleting the $k$-th term from the sequence is an integer, then $\frac{2015^{2}-(2 k-1)}{2014} \in \mathbf{Z}$. Noting that $2015^{2}=2014 \times 2016+1$, the above equation is equivalent to $2014 \mid 2(1-k)$, i.e., $1007 \mid(1-k)$. Also, $1 \leqslant k \leqslant 2015$, so the set of values for $k$ is $\{1,1008,2015\}$. It is easy to verify that when the 1st, 1008th, or 2015th term is deleted, the arithmetic mean of the remaining terms in the sequence is an integer.