Sam has 3000 bananas. He had to take them to 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 1km it travels. What is the maximum number of bananas that Sam can take to the market?