Stability and cooperativity of hydrogen bonds in dihydroxybenzoic acids