Count up then down using the dual 4 bit 4520 counter IC and the quad 2 input XOR gate IC. It uses the XOR gates to inverse (like shown here) the clock result using the 5th bit of the counter. The 2 counters of the 4520 are connected to receive a 5th bit.
simulation












