Update count of possible pair
possiblePair += min ( freq [ firElement ] , freq [ sum - firElement ] ) NEW_LINE sum += 1 NEW_LINE if ( sum % 2 == 0 ) : NEW_LINE possiblePair += freq [ sum // 2 ] // 2 NEW_LINE