updated getcount function in stacks.h