how to count the no. in an array or list?