A sequence $\{a_n\}$ satisfies the following conditions:  
- $a_0 = 0$  
- $a_1 = a_2 = 1$  
- $a_{3n} = a_n$  
- $a_{3n+1} = a_{3n+2} = a_n + 1$  
for all $n \geq 1$. Compute $a_{2021}$.

Let's think step by step and output the final answer within \boxed{}.
user