Calculating total slots Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (cooling off slots)? However, a different job can be assigned in this cooling off slots.

For example,

[9,10,9,8] =&gt; output: 5


Because jobs will be allocated as [9 10 _ 9 8]. 
1. First, 9 needs two cooling off spots _ _. So we start with 9 _ _.
2. Next job 10 is different from the previous job 9, so we can allocate one of _ _. Then we will have 9 10 _.
3. Third, 9 cannot be allocated now, since first job 9 is the same job and it needs cooling off time. 9 10 _ 9.
4. Last, 8 is not same as any other previous two jobs, so it can be allocated right after 9 and since this is last job, it does not need cooling off time. Final list is 9 10 _ 9 8 and expected output is 5, which is the number of spots (or number of slots)

Test cases:

[1,2,3,4,5,6,7,8,9,10] =&gt; output : 10 ([1 2 3 4 5 6 7 8 9 10])
[1,1,1] =&gt; output: 7 ([1 _ _ 1 _ _ 1])
[3,4,4,3] =&gt; output: 6 ([3 4 _ _ 4 3])
[3,4,5,3] =&gt; output: 4 ([3 4 5 3])
[3,4,3,4] =&gt; output : 5 ([3 4 _ 3 4])
[3,3,4,4] =&gt; output : 8 ([3 _ _ 3 4 _ _ 4])
[3,3,4,3] =&gt; output : 7 ([3 _ _ 3 4 _ 3])
[3,2,1,3,-4] =&gt; output : 5 ([3 2 1 3 -4])
[] =&gt; output : 0 ([])
[-1,-1] =&gt; output : 4 ([-1 _ _ -1])


Input value can be any integer (negative, 0, positive). 
Length of job-list is 0 &lt;= length &lt;= 1,000,000.
Output will be an integer, the total number of slots, which is indicated in test case as output. The list inside the parenthesis is how the output would be generated.

Winning criterion
code-golf
05AB1E, 22 bytes
v¯R¬yQiõˆ}2£yåiˆ}yˆ}¯g

Try it online or verify all test cases.
Explanation:

v           # Loop over the integers `y` of the (implicit) input-list:
 ¯R         #  Push the global_array, and reverse it
   ¬        #  Get the first item (without popping the reversed global_array itself)
    yQi  }  #  If it's equal to the integer `y`:
       õˆ   #   Add an empty string to the global_array
   2£       #  Then only leave the first 2 items of the reversed global_array
     yåi }  #  If the integer `y` is in these first 2 items:
        ˆ   #   Add the (implicit) input-list to the global_array
 yˆ         #  And push the integer `y` itself to the global_array
}¯g         # After the loop: push the global array, and then pop and push its length
            # (which is output implicitly as result)