Learning and processing the ordinal information of temporal sequences in recurrent neural circuits