4. If any $n$ integers are taken, it is always possible to select three numbers whose sum is divisible by 3. Then the minimum value of $n$ is ( ).
(A) 2
(B) 3
(C) 4
(D) 5
4. D.

On one hand, the sum of any three numbers chosen from 0, 1, 3, 4 is not divisible by 3.

On the other hand, when an integer is divided by 3, the remainder falls into one of three categories: 0, 1, or 2. For any five integers, if there are three with the same remainder when divided by 3, their sum can be divisible by 3. Otherwise, among the five numbers, there are at least three numbers with different remainders when divided by 3, and their sum is divisible by 3.