Let $n$ be a natural number. Consider $2 n+1$ tickets, each having a number which is a positive integer. Suppose that the sum of the numbers on the $2 n+1$ tickets does not exceed 2330 but that the sum of the numbers on any group of $n$ tickets is always greater than 1165.

Determine the maximum value of $n$.
(solved by Yaël Dillies)

Let $a_{1}<\cdots<a_{2 n+1}$ be the numbers written on the tickets.

We directly have $a_{i} \leqslant a_{j}+(i-j)$ for all $1 \leqslant i \leqslant j \leqslant 2 n+1$. Therefore, for all $i \in \llbracket 1, n+1 \rrbracket$,

$$
a_{i}=\frac{n a_{i}}{n} \leqslant \frac{1}{n} \sum_{j=n+2}^{2 n+1}\left(a_{j}+i-j\right)=\frac{a_{n+2}+\cdots+a_{2 n+1}}{n}+i-\frac{3}{2} n(n+1)
$$

Applying this to $i=1, \ldots, n+1$, we get:

$$
\begin{aligned}
2330 & \leqslant \sum_{i=1}^{2 n+1} a_{i} \\
& =\sum_{i=1}^{n} a_{i}+\sum_{i=n+1}^{2 n+1} a_{i} \\
& \leqslant \sum_{i=1}^{n+1}\left(\frac{a_{n+2}+\cdots+a_{2 n+1}}{n}+i-\frac{3}{2}(n+1)\right)+a_{n+2}+\cdots+a_{2 n+1}
\end{aligned}
$$

$\leqslant 1165\left(2+\frac{1}{n}\right)+-(2 n+1) \frac{n+1}{2}$

From this, we derive $n\left(n+\frac{1}{2}\right)(n+1) \leqslant 1165$, and thus $n \leqslant 10$ since $1165<1331=11^{3}<11$. $\left(11+\frac{1}{2}\right)(11+1)$ and the quantity $n\left(n+\frac{1}{2}\right)(n+1)$ is increasing in $n$. Conversely, $n=10$ is possible by taking $a_{i}=100+i$ for all $i \in \llbracket 1,21 \rrbracket$:

$-a_{1}+\cdots+a_{21}=21 a_{11}=21 \cdot 111=2331 \geqslant 2330$

$-a_{i_{1}}+\cdots+a_{i_{10}} \leqslant a_{12}+\cdots+a_{21}=10 \cdot \frac{121+112}{2}=1165$

The maximum sought is therefore 10.