Sam has 3000 bananas. He takes them to the market 1000 km away on his only camel. The camel can only carry 1000 bananas at a time. The camel eats 1 banana for every 1 km it travels. What is the maximum number of bananas that Sam can take to the market?