Adding count to document