Consider .. X = {1, 2, 3, 4}, x = 4 .. Y = {2, 3, 4, 5, 6}, y = 5, w = 3 The elements in X or Y (X ∪ Y) are {1, 2, 3, 4, 5, 6}, n = 6. .. n = 6 = 4 + 5 - 3
Note that if we just add x and y, we count the common elements twice. In order to just count the common elements once, we need to subtract that count from the total of x and y.