The chi-square statistic, when calculated based on a contingency table, considers only the diference between observed and predict values and different combinations of observed values can results in the same statistic.
In continuation, to obtain the p-value it is necessary the number of degress of freedom, but it is not based on the sample size, but in the dimensions of the table.