How to connect LEDs to RX0/TX1 and still be able to flash?

I've tried to connect 2 leds on Digital Pin0 and Digital Pin1. I know it's connected to UART RX/TX. After this connection I wasn't able to flash device - no response.
But there must be some way to isolate this LEDs from RX/TX pins during programming(except putting release buttons).

So I want to have LEDs on those pins (using all pins on Arduino UNO) and be able to program board.

What have you got connected to all the other pins ? more leds?

The best way is to switch them out. That is physically disconnect them.

Alternatively you can use a buffer or a transistor to isolate them from the serial signals. They will then flash as you upload stuff but when the sketch starts running they will be fully controllable.

Other LEDs, SPI. The number of pins are exactly matches to requirements if I only can isolate them and use flash device without disconnecting LEDs.

acid:
Other LEDs, SPI. The number of pins are exactly matches to requirements if I only can isolate them and use flash device without disconnecting LEDs.

Could you please give me some reference values of elements?

You can drive loads of LEDs from 3 pins with a shift register ....

acid:
Other LEDs, SPI. The number of pins are exactly matches to requirements if I only can isolate them and use flash device without disconnecting LEDs.

You can't without isolating the LEDs from the serial input. As I said before you fdo this either electrically or mechanically.