The number of components is equal to the number of distinct chemical species (constituents), minus the number of chemical reactions between them, minus the number of any constraints (like charge neutrality or balance of molar quantities).