Count number of grains