Split rd_stats.c and rd_stats.h files

rd_stats.c file was becoming really big. So remove from it functions
used to count the number of items and put them in a separate file
(count.c).
Functions prototypes go to count.h.