In the general case we have the following: Let and be sets. Let be a subset of . Suppose that, for , the element is the first component of pairs in , while, for , the element is the second component of pairs in . Then .
So suppose and . So if is the first component of pairs of , is the first component of pairs of etc.. and is the second component of pairs of etc...then .
But we don't know what and are. We just know that they represent the number of pairs with the first component being and the second component being respectively. Is this the whole point?