Let $k$ be an algebraically closed field, $\ell$ is a prime different with characateristic of $k$, and consider the $\ell$-adic etale cohomology. We know the number of connected components of a scheme finite type over $k$ by looking at $H^0$, but how about the number of irreducible components?

Looking at the example $\{xy=0\}$ in $\mathbb P^2$ which has $1$-dim $H^0$ and $2$-dim $H^2$, it seems that the number has something to do with top dimensional etale cohomology.

So the question is: let $X$ be a connected equidimensional finite type scheme over $k$ (of dimension $n$), when do we know $\dim_k (H^{2n}_{c}(X))$ is equal to the number of irreducible components of $X$ ?

The complex case is partially discussed in https://math.stackexchange.com/questions/2393326/top-cohomology-and-irreducible-components, but the proof does not work in positive characterisitc case.