Sum[j-i, {j,i+1,n-1}]