The invention relates to compounds of formula (I), wherein ring A, X, (R1)n, R2, R3, R4, R4, R5, n, and p are as described in the description. The invention also relates to pharmaceutically acceptable salts thereof, and to the use of the compounds as medicaments, especially as modulators of the CXCR3 receptor.