beginner blocks - threads question

I have an 3d array of 24000 elements and their position in space. I need calculate the distance from every element to all the rest. The elements at the beginning of the array will have the bulk of the calculations and the elements at the end of the array will have the least amount of calculations. The sequential code looks like this:
For x: 1 to 24000
For y:x+1 to 24000
Calculate distance between x and y

What would be the best way to split the elements among Blocks/Threads?
dim3 grid(???);
dim3 threads(???);

Thank you