Deriving the number of loops and number of lines meeting at a vertex in a diagram When reading about Superficial Degrees of Divergence (SDOD) I have seen in An Introduction to Field Theory (Chapter 10.1) that for Lagrangians with a $\phi^n$ interaction term we know that:
$$\tag{1} L=P -V +1,$$
$$\tag{2} nV = N + 2P,$$
Where $L$ represents the number of loops in a diagram, $P$ the number of internal propagators, $N$ the number of external lines and $V$ the number of vertices. 
The degree of divergence of the diagram is given by:
$$\tag{3}D=dL-2P.$$
Why is this so? Is there a way to derive these equations though calculations or is it just a known fact?
 A: *

*For a connected Feynman diagram the superficial degree of (UV) divergence $D$ is defined as
$$ D~:=~ \#\{\text{$\mathrm{d}p$ in int. measure}\} ~+~ \#\{\text{$p$ in numerator}\}~-~ \#\{\text{$p$ in denominator}\}. $$
The 1st term on the RHS is $Ld$. The 2nd term on the RHS is 0 if there are no derivative couplings. In the simplest cases, the 3rd term on the RHS comes from $P$ internal scalar propagators. This leads to OP's eq. (3). A generalization of eq. (3) is discussed in my Phys.SE answer here.

*OP's eq. (2) essentially follows from a counting argument: Each propagator has 2 ends.

*Eq. (1) is explained in my Phys.SE answer here.
A: if you have something like this :
$$\sim \int \dfrac{d^4 k_1 d^4 k_2 \dots d^4 k_L}{(\bar{k}_i-m) \dots k^2_j \dots }$$
that for each propagator you have power of 2 of momentum in denominator and for each loop you have power of $d-1$  of momentum for measure of integral in numerator that after integrating become $d$.so for degree of divergence you should calculate(Show that with ND) :
$ND = (power\ of\ $k$\ in\ numerator - power\ of\ $k$\ in\ denominator)$.(after integrating that plus 1 to measure of numerator)
because we have $L$ measures that should be integrating, for power of $k$ in numerator we have $dL$(after integrating) , and because we have $P$ propagator each have power of $2$ in denominator so power of $k$ in denominator should be $2P$. so final result for degree of divergence is $dL-2P$.
