Jake had some indonesia and china stamps in the ratio 8:3. After he sold 240 indonesian stamps and bought another 160 china stamps, he had and equal number of indonesia and china stamps. How many indonesia stamps did he have at first?

Let's assume Jake had 8x Indonesia stamps originally.

This means he had 3x China stamps.
After selling 240 Indonesian stamps, he had 8x - 240 Indonesian stamps left.
After buying 160 China stamps, he had 3x + 160 China stamps.
Since he had an equal number of Indonesian and Chinese stamps, we can set up the equation: 8x - 240 = 3x + 160.
Subtracting 3x from both sides of the equation, we get: 5x - 240 = 160.
Adding 240 to both sides of the equation, we get: 5x = 400.
Dividing both sides of the equation by 5, we get: x = 80.
So, Jake had 8x = 8 * 80 = <<8*80=640>>640 Indonesian stamps at first. Answer: \boxed{640}.