A farmer had 500 chickens. He sold 175 chickens at the market, and then he bought 120 more chickens. Later, he gave away 50 chickens to his neighbor. How many chickens does the farmer have now? Let's think step by step and output the final answer within \boxed{}.
user