Suppose $|\alpha_1| \le |\alpha_2| \le \cdots \le 1$, $n(r) = \#\{\alpha_j \le r\}$. Prove $\int_0^1n(r)dr = \sum_{j=1}^\infty(1-|\alpha_j|)$. I'm trying to solve the following exercise from chapter 15 of Rudin's Real and Complex Analysis:

Suppose $|\alpha_1| \le |\alpha_2| \le \cdots \le 1$, and let $n(r)$ be the number of terms in the sequence $\{\alpha_j\}$ such that $|\alpha_j| \le r$. Prove that: $$\int_0^1n(r)dr = \sum_{j=1}^\infty(1-|\alpha_j|)$$

$a_j$ are complex numbers.
My thoughts:
Make $\alpha_0 = 0$, $r_j = |\alpha_j|$.
$$\int_0^{r_{N+1}}n(r)dr = \sum_{j=0}^N\int_{r_j}^{r_{j+1}}n(r)dr = \sum_{j=0}^Nj(r_{j+1}-r_j) = Nr_{N+1} + \sum_{j=1}^N(-r_j)$$
As $N\to\infty$, the left side is less or equal to the integral we are interested in but $Nr_{N+1}$ doesn't approach $1$. What concerns me is that it actually approaches $\infty$ so I suspect I'm doing something wrong. What is it? How can I prove this statement? Thanks.
 A: 
This follows from a double summation/integration, call it Fubini theorem if you wish. 

To see why, consider some (countable) collection of numbers $x_i$ in $[0,1]$ and $n(r)$ the number of indexes $i$ such that $x_j\leqslant r$, that is,
$$
n(r)=\sum_i\mathbf 1_{x_i\leqslant r}.
$$
Then,
$$
\int_0^1n(r)\,\mathrm dr=\int_0^1\sum_i\mathbf 1_{x_i\leqslant r}\,\mathrm dr=\sum_i\int_0^1\mathbf 1_{x_i\leqslant r}\,\mathrm dr,
$$
where the last identity is Fubini theorem applied to the product of the counting measure and Lebesgue measure on $[0,1]$, both sigma-finite. Now, each integral in the rightmost sum is
$$
\int_0^1\mathbf 1_{x\leqslant r}\,\mathrm dr=\int_x^1\mathrm dr=1-x,
$$
for some $x$, where the first identity uses the fact that $0\leqslant x\leqslant1$. Applying this to $x=x_i$ with $x_i=|\alpha_i|$ for each $i$ and summing over every index $i$, you are done.
A: Your calculation is correct but not complete. Let $r_j:=|\alpha_j|$. If $r_j\to x$ and $x<1$, then it is easy to see that both sides are equal to infinity. Actually, you've proved it partially. 
Case 2: Assume $r_j\to 1$. Then it is easy to see that the LHS integral is equal to the following series:
$$
\sum_{j=1}^\infty (r_{j+1}-r_j)j.
$$
let $S_n$ denote the summation of first $n$ terms of this series. Then you can see that 
$$
S_n=\sum_{j=1}^n (r_{n+1}-r_j).
$$
Taking limit when $n\to \infty$ proves proves the equality.
