A consecutive sequence has a starting number. For $[1, 2, 3, 4]$, the start is $1$. You know $x$ is a start if $x - 1$ does not exist in the array.
For each potential start, count how many consecutive numbers follow it. Use a set for $O(1)$ membership checks.
This avoids counting the same sequence multiple times. You only start counting from the beginning of each sequence.