Find all integers $a$ s.t. $2x\equiv a$ (mod $24$) and $4x\equiv a^2$ (mod $15$) has a solution. I just finished my mid-term test of elementary number theory and this is a problem in the test that I failed to solve: Find all integers $a\in \mathbb{Z}$ s.t. the system 
$$2x\equiv a\ \ (\text{mod }24)$$
$$4x\equiv a^2\ \ (\text{mod }15)$$
has a solution.
I guess it's some-how related with the map $f:\mathbb{Z}/60\mathbb{Z}\to\mathbb{Z}/24\mathbb{Z}\times\mathbb{Z}/15\mathbb{Z}:[x]_{60}\mapsto([2x]_{24},[4x]_{15})$, for the previous problem asked us to prove that $f$ is well-defined. However, I didn't figure out what the relation is.
I'd be grateful if anyone could provide some hints, methods or the whole solution. 
EDIT: Thank you all! I think I've solved it. There is nothing related with $f$. I was cheated. 
My solution has been posted as an answer below, if you want to have a look.
 A: Thank you all! I think I've solved it. There is nothing related with $f$. I was cheated.
My Soluiton: The equation $2x\equiv a$ (mod $24$) has a solution if and only if $\gcd(2,24)=2\mid a$, and this solution is congurent modulo $24/2=12$. So $a$ must be even and the first equation is equivalent to 
$$x\equiv \frac{a}2\ \ (\text{mod }12).$$
(For if $2x=a+24y$ for some integer $y$, then $x=\frac{a}{2}+12y$, which gives the result above.)
For the second equation, multiply a $4$ on both sides and 
$$4x\equiv a^2\ \ (\text{mod } 15)\Leftrightarrow x\equiv 4a^2\ \ (\text{mod } 15)$$
Now we know that the original system is equivalent to
$$x\equiv \frac{a}2\ \ (\text{mod }12)$$
$$x\equiv 4a^2\ \ (\text{mod } 15)$$
By a generalization of the Chinese Remainder Theorem, this system has a solution if and only if $\gcd(12,15)=3\mid (4a^2-\frac{a}{2})=\frac{a}{2}(8a-1)$, if and only if $3\mid \frac{a}{2}$ or $3\mid (8a-1)$. For $a$ must be even, the result is all integers in the set
$$\{6k:k\in \mathbb{Z}\}\cup \{6k+2:k\in \mathbb{Z}\}.\tag*{$\square$}$$
Shame I didn't figure this out during my test. Anyway, thank you all.
