explain the setelems n + setelems 0 trick