Can we find size of total interval in O(N)
There is a simple $O(n\log n)$ algorithm based on sorting all the endpoints of the intervals. I will describe a more sophisticated algorithm, which outputs the union of the input intervals as a union of internally disjoint intervals (they may have overlapping endpoints). Denote the input intervals by $[s_i,t_i]$.


Initialize a variable $a$ to 0. This variable counts the number of active intervals.
Let $x$ go over the sorted order of the $s_i,t_i$:

If $x = s_i$ and $a = 0$, record $s_i$ as the starting point $s$ of the current interval.


If $x = s_i$ (regardless of $a$), increase $a$ by one.


If $x = t_i$, decrease $a$ by one. If now $a = 0$, output $[s,x]$.



It is not hard to modify this algorithm to output a union of truly disjoint intervals.

This algorithm runs in $O(n\log n)$, the running time being dominated by the cost of sorting the endpoints of the intervals. If the endpoints are integers and we can only access them using comparisons, then there is a simple $\Omega(n\log n)$ lower bound obtained by reduction from element uniqueness. Given a list of integers $x_1,\ldots,x_n$, form intervals $[3x_i,3x_i+1]$; I'll let you take it from here. This might look like cheating (since we assume that the endpoints are integers, and use arithmetic operations in the reduction), but it does rule out certain kinds of algorithms from achieving $o(n\log n)$ performance.