calculate number in each group in Index.html