data logging/processing

If you scale down the number of animals 'in' or 'out' as a fraction of your total number of animals, each data would only differ between 0%-100% .
That way you keep the usage of memory low. Probably not more than a few hundred bytes in a two-dimensional array.