Choose three numbers. With no rules you have three free choices. Add a rule: they must sum to 10. Now you can pick the first two however you like, say 4 and 1, but the third is forced to be 5. Add a second rule: the first number is 2 more than the second. Pick the third number, say 4; then the first two must add to 6 and differ by 2, so they are 4 and 2. Each independent rule removed one free choice, leaving 3−2=1 degree of freedom.
The word independent matters. The rule "twice the sum is 20" adds nothing to "the sum is 10", because it says the same thing in different words. A rule like that removes no choice, so you count only rules that tell you something new. In two variables, x+2y=4 and 3x+6y=12 are one rule written twice: 2−1=1 degree of freedom, and the solutions form a whole line.
Degrees of freedom count choices, not solutions. When n−r=0, no choice is left, so there can be at most one solution, but the rules might still clash. "Two numbers add to 10" and "the same two numbers add to 12" give 2−2=0, yet no pair satisfies both. Checking that the rules can hold together comes before trusting the count.
Think of it like this. Splitting a $60 budget among food, games and travel works like degrees of freedom: you can set any two amounts, and the third is whatever is left. Three amounts minus one rule leaves two free choices. Fix travel at $10 as a second rule and only one choice remains.
Core idea. Degrees of freedom count how many values you can still choose freely after every constraint is imposed.