A city currently has a population of 50,000 people. The population grows at a rate of 3% per year, but 500 people leave the city every year. Using algebraic equations, determine the population of the city after 5 years. Let's think step by step and output the final answer within \boxed{}.
user