Let the number of years be 't'. The population of Village X decreases by 1200 per year. After 't' years, the population will be 78000 - 1200t. The population of Village Y increases by 800 per year. After 't' years, the population will be 52000 + 800t. We want to find 't' when the populations are equal: 78000 - 1200t = 52000 + 800t.