# A sequence of integers

A sequence \(\{a_i\}_{i=1}^{\infty} \) of integers is defined by: \[ a_n= \begin{cases} 1 &\mbox{if } n \leq 3 \\ 0 & \mbox{if } n= 4 \\ \left ( a_{n-1} + a_{n-2} + a_{n-3} \right ) \pmod{2} & \mbox{if } n>4 \end{cases} \] Here \(n \pmod{2} \) denotes the remainder when \(n\) is divided by \(2\), i.e. \[n \pmod{2}= \begin{cases} 0 & \mbox{if } n \equiv 0 \pmod{2} \\ 1 & \mbox{if } n \equiv 1 \pmod{2} \end{cases} \] Find the number of integers \(n\) such that \(1 \leq n <25\) and \(a_n= 1\).