Design a 3-bit non-binary counter that will count in the sequence 000, 010, 011, 101, 110, 111 when the input signal X = 0, clockwise rotation. If input signal X = 1 it reverses the direction, counterclockwise. The counter has two unused states. These are 001 and 100. Implement the counter as self-correcting such as that if the counter happens to be in one of the unused states (001 and 100) due to an error, after one clock cycle puts state 001 to 011 or state 100 to state 111 which are valid states and the counter provides the correct count. Use T Flip- flops for your design.