Compare array values

I have a problem with comparing values inside of an array.
Global A consisft of vectors with identical Y component (the first two actions).
The thing I want to do is to remove each vector from this array if its distance between any value inside of Global A is less than 40, however, [for… to…] action doesn’t seem to work. It somehow skips a lot of vectors which don’t fit the distance condition. Here’s the code:

variables
{
global:
19: Temp
}

actions
{
Global.A = Mapped Array(Spawn Points(All Teams), Position Of(Current Array Element));
For Global Variable(Temp, 0, Count Of(Global.A), 1);
If(Is True For Any(Global.A, Distance Between(Current Array Element, Global.A[Global.Temp]) < 40) == True);
Modify Global Variable(A, Remove From Array By Index, Global.Temp);
End;
End;
}

Also you don’t need the For Loop to Remove the Elements that don’t fit the Condition

If I do this:

Global.A = Filtered Array(Global.A, Distance Between(Global.A, Global.A[Global.Temp])

Wouldn’t it just compare the array with the value Global.A[Temp]? If I understand that correctly, Temp will be 0 since there is no “for” cycle to change Temp value, so that means the array will be compared with the value which index is 0.
Anyway, thanks for the help, I figured it out. The entire condition was wrong and the array would return 0 no matter how small the distance was because it is naturally impossible for spawnpoints to be so far apart from each other. I changed it a bit and now everything works perfectly