Get 4 smallest distance

OK, I already know how to find the smallest distance:

for(var i = 0;i<nodes.Length;i++){
var actualdistance = Vector3.Distance(enemy.position,nodes*);*
*if(i == 0){*
*mindistance = actualdistance;*
*}*
*if(actualdistance < mindistance){*
*mindistance = actualdistance;*
*start = i;*
*}*
*}*
*```*
*<p>but Know what I am trying to figure it out is how to make this but not only with the smallest distance, get lets say the 4 smallest distance so my question is, how can I do this?</p>*

If you only want the 4 smallest distances as you asked, fill an array with the distances, do an Array.Sort() then grab the first 4 elements of that array.

Here are the docs for Array:

http://unity3d.com/support/documentation/ScriptReference/Array.html