How it will work if value is negative?

If array contains -5,-2,-1,0,1,2,5 then what will we do to sort negative values as indexing cannot be negative.

You can modify the array if you have negative values so that all values are greater than or equal to 0.
In the array - -5 -2 -1 0 1 2 5, add 5 to all the values.
So the new array is - 0 3 4 5 6 7 10
Now apply counting sort algorithm and while displaying values, first subtract 5 from them.