Fun challenge, use this formula.

Row\Column
A
B
C
D
1 Start date End date Duration Duration (no overlap)
2 6-Jan 10-Jan 5 19
3 13-Jan 20-Jan 8
4 12-Jan 22-Jan 11
5 18-Jan 25-Jan 8

Formula in D1 (array formula)
Formula: copy to clipboard
=SUM(1*(MMULT(((MIN(A2:A5)-ROW(A2)+ROW(OFFSET(A2,0,0,MAX(B2:B5)-MIN(A2:A5)+1,1)))>=TRANSPOSE(A2:A5))*((MIN(A2:A5)-ROW(A2)+ROW(OFFSET(A2,0,0,MAX(B2:B5)-MIN(A2:A5)+1,1)))<=TRANSPOSE(B2:B5)),1*(ROW(A2:A5)>0))<>0))

This is an array formula, please copy in the formula, then hit CTRL SHIFT ENTER to finalise the formula rather than just enter.