How to display on my number of free parking on 4 digit 7segment using IR obstacl

Note: LED are working fine when there is presence of a car and when no car.

So, you can turn an LED on when needed, and off when needed.

You know how many are on initially. They don't come on or go off randomly. So, increment a counter when you turn one on and decrement the counter when you turn one off. Now, you KNOW the value to display. So, do it. What is the problem? Aside from the fact that your wiring diagram doesn't show that you have a seven segment display.