I have found code on this forum and it ensures that sorting is done first in X-Direction and then in the Y-Direction or vice versa.
somehow the second sorting goes wrong, this sorting does not affect the first sort order.
If I bypass these nodes then the result is the same.
The numbers in Math.Round = 15 if I lower this, the result is worse.
I hope that you can help.