I have three input levels: 0V, 2.5V & 5V.
Output I need is:
A). 5V or 0V input, then output 0V
B). 2.5V input, then output is 5V
Need to made this circuit by using low cost transistors only. I tried making below circuit, but seems like transistor as buffer is not working. Can someone suggest correct method with lowest transistor count

Output I need is:
A). 5V or 0V input, then output 0V
B). 2.5V input, then output is 5V
Need to made this circuit by using low cost transistors only. I tried making below circuit, but seems like transistor as buffer is not working. Can someone suggest correct method with lowest transistor count
