Five-bit counter with auto wrap around to 0
counter++ & B00011111;
If your output pins are on the same port and in a row then something like this
PORTB &= B11100000;
PORTB != counter;
If they are on pins all over the place then extract the bits and use a series of digitalWrites() to set the pins.
Rob