8. In the sequence $\left\{a_{n}\right\}$, if $a_{i}+a_{i+1}+a_{i+2}$ is odd, then $\left(a_{i}, a_{i+1}, a_{i+2}\right)$ is called a "triple". For example, in 6, $4,2,1,3,5$, there are exactly two triples: $(4,2,1)$ and $(1,3,5)$. If $a_{1}, a_{2}, \cdots, a_{2021}$ is a permutation of $1,2, \cdots, 2021$, then the maximum number of triples in the sequence $a_{1}, a_{2}, \cdots, a_{2021}$ is $\qquad$
8. 2018.

Construction: $100100100 \cdots 1001111 \cdots 1$ (505 100s and 506 1s, where 1 represents an odd number, 0 represents an even number), thus there are 2019 consecutive sums, among which, 2018

are big triplets, 1 is not a big triplet.
Proof below: $a_{1}, a_{2}, \cdots, a_{2021}$ contains at least three consecutive terms whose sum is even.
Proof by contradiction.
Assume the conclusion is false, i.e., $a_{1}, a_{2}, \cdots, a_{2021}$ contains no three consecutive terms whose sum is even.

Then $a_{k}+a_{k+1}+a_{k+2}$ and $a_{k+1}+a_{k+2}+a_{k+3}$ are both odd.
Thus, $a_{k}$ and $a_{k+3}$ have the same parity.
Without loss of generality, assume $a_{1}, a_{2}, a_{3}$ contain two even numbers (or all are odd). Then $a_{3 k-2}, a_{3 k-1}, a_{3 k} (k=1,2, \cdots, 667)$ these 667 groups of numbers contain at least 1334 even numbers (or 2019 odd numbers), which is a contradiction.
Therefore, the maximum number of big triplets is 2018.
In conclusion, the answer is 2018.