A warehouse tracks item counts in an array `stock`. Two shelves can be merged into one truckload only if their counts add up to exactly `capacity`. Return the number of unordered index pairs (i, j) with i < j such that stock[i] + stock[j] == capacity.