You can set it to Modulo (%) 5 every time it changes. Then it will always have value between 0 and 4.