Degrees of freedom for linear regression I'm reading on a text book about linear regression, and when I thought I finally understood degrees of freedom, I found a statement that made me doubt what I know so far. Well it's in the context of a simple linear regression (1 input).

The orange, blue and green squares
  indicate the MSEs associated with the corresponding curves in the lefthand
  panel. A more restricted and hence smoother curve has fewer degrees
  of freedom than a wiggly curve—note that in Figure 2.9, linear regression
  is at the most restrictive end, with two degrees of freedom.

What degree of freedom they talking about in here? 
What I know is that: df(regression)=p with p is the number of features used. So for this case it must be 1.
df(residuals)=n-(p+1).
df(total)=n-1.
n is the sample size.
Any help on what that 2 might be? 
Here is the two panels of the figure 2.9.


 A: I second @Penguin_Knight 's assertion in the comments: The second loss of d.f. comes from the intercept term in $\hat{y}=\hat{\beta_0} + \hat{\beta_1}x_1$. Every term you must estimate removes a degree of freedom from the residuals.
Most texts I have seen denote $\text{df(residuals)} = n - p$, where $p$ is the number of parameters you estimated in the model (so for linear regression, the number of covariates plus one). 
A: This is about overfitting. You can fit a higher order polynominal to the curve and archive lower MSE (1st Figure). In your case you have a simple function $f(x)$ with $x$ having 1 dimension. Now you can try to fit a linear curve $\hat f(x) = ax + b$ or a higher order polynomal like $\hat f(x) = ax^3 + bx^2 + cx + d$ using linear regression (2nd Figure). You are still learning linear parameters $a,b,c,d$ by solving $\min_{a,b,c,d}(\hat f(x) - y)^2$, hence linear regression. 
However, this might overfit on the training data and perform worse on your actual use case. (1st Figure) 
