As we know,
the mass number of an atom = No. of protons + No. of Neutrons
So,
The mass number of X = No. of protons of X + No. of Neutrons of X
= 6 + 6
= 12
The mass number of Y = No. of protons of Y + No. of Neutrons of Y
= 6 + 8
= 14
As both X and Y have the same atomic number (6) but different numbers (i.e., 12 and 14 respectively), they are isotopes.