separate elements in two groups
use unsigned long instead of int or unsigned int when traversing the pools