Why the count is not printing even after typecasting it?