[Question]
  [
Your task today is to write a program or function that takes an array of integers, and counts the number of times, reading it left to right, that the value changes. This is easier to show with an example: `[1 1 1 2 2 5 5 5 5 17 3] => [1 1 1 **2** 2 **5** 5 5 5 **17** **3**] => 4`
Test case:
```
Input           |   Output
[]              |   0
[0]             |   0
[0 1]           |   1
[0 0]           |   0
[1 2 3 17]      |   3
[1 1 1 2 2 3]   |   2
[-3 3 3 -3 0]   |   3
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), fewest bytes wins!
  
[Answer]
# [MATL](https://github.com/lmendo/MATL), 2 bytes
```
dz
```
[Try it online!](https://tio.run/##y00syfn/P6Xq//9oQwUQNAJCUyg0NFcwjgUA) Or [verify all test cases](https://tio.run/##y00syfmf8D@l6r9LyP/oWK5oAxBWMASTILahgpGCsYIJmAWCRiA@kKdrrACCQMogFgA).
### Explanation
```
     % Implicit input
d    % Consecutive differences
z    % Number of nonzeros
     % Implicit display
```
[Answer]
# [Python 3](https://docs.python.org/3/), 38 bytes
```
f=lambda x=0,*y:y>()and(x!=y[0])+f(*y)
```
[Try it online!](https://tio.run/##JU1LCsMgFNz3FK8LiaZP0CSLEjAXEReWIA20JtgU4umtL2VgvovZ8v5cY19KMC//fsweDqOwzWOeuPBx5sfVZKucuAXeZlHCmsCn5DMsEaxDqBsR6r/UZDV22ONAhUZCRwVF2SOhinLjBWBLS9x5w6S@f0BOwL4NMODnAUJ9PJ0QovwA "Python 3 – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 33 bytes
```
f(a:b:r)=sum[1|a/=b]+f(b:r)
f _=0
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00j0SrJqkjTtrg0N9qwJlHfNilWO00DJMSVphBva/A/NzEzT8FWoaAoM69EQUUhTSHaUAcEjYHQCEib6JjE/gcA "Haskell – Try It Online")
---
**Bonus:** Somewhat curious point-free arithmetic version (44 bytes)
```
sum.(tail>>=zipWith((((0^).(0^).abs).).(-)))
```
[Try it online!](https://tio.run/##y0gszk7NyfmfZhvzv7g0V0@jJDEzx87OtiqzIDyzJEMDCAziNPXARGJSsaYekK2rqan5PzcxM0/BVqGgKDOvREFFIU0h2lAHBI2B0AhIm@iYxP7/l5yWk5he/F83uaAAAA "Haskell – Try It Online")
Given an input `[1,1,4,3,3,3]`, we first take the difference of adjacent entries (`[0,3,-1,0,0]`), then the `abs`olute value: `[0,3,1,0,0]`. Taking zero to the power of each element the first time yields `[1,0,0,1,1]`, and a second time inverts the list: `[0,1,1,0,0]` (`(1-)` would also work here instead of `(0^)`). Finally we take the `sum` of the list to get `2`.
[Answer]
# [Python 2](https://docs.python.org/2/), 42 bytes
```
lambda a:sum(x!=y for x,y in zip(a,a[1:]))
```
[Try it online!](https://tio.run/##HUnLCoUgEN33FdNOYYK0VkJfYi4mLnKFMukB2c9bE4fzTvn4r1EXP4xlpmX6EZDZz0Vc9ZDBrxtcmCFEuEMShGSVcVIWPohn69C2TFSfclaoscP@SwzN/W1Nh4zXWmcqgLSFeIAXJMsD "Python 2 – Try It Online")
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), 8 bytes
**Solution:**
```
+/1_~~':
```
[Try it online!](https://tio.run/##y9bNz/7/X1vfML6uTt3KUAEEjYDQFAoNzRWM//8HAA "K (oK) – Try It Online")
**Examples:**
```
+/1_~~':1 1 1 2 2 5 5 5 5 17 3
4
+/1_~~':()
0
+/1_~~':-3 3 3 -3 0
3
```
**Explanation:**
Interpreted right-to-left:
```
+/1_~~': / the solution
     ~': / equal each-previous
    ~    / not (ie differ)
  1_     / 1 drop, remove first as this is different to null
+/       / sum up trues
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 50 bytes
```
([][()]){{}({}[({})]){{}<>({}())(<>)}{}([][()])}<>
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/XyM6NlpDM1azurpWo7o2GoghHBs7IFNDU1PDxk6zFsiCKgOK//9vqACCRkBoCoWG5grGAA "Brain-Flak – Try It Online")
Outputs nothing for 0, which in brain-flak is equivalent. If this is not acceptable, than append this for `+4` bytes: `({})`
Explanation:
```
#Push stack-height-1
([][()])
#While true:
{
    #Pop the stack-height-1 off
    {}
    #If 'a' is the element on top of the stack, and 'b' is the element underneath it, then
    #Pop 'a' off, and push (a - b)
    ({}[({})])
    #If (a-b) is not 0...
    {
        #Pop (a-b) off
        {}
        #Switch stacks
        <>
        #Increment the value on the other stack
        ({}())
        #Push a 0 back to the main stack
        (<>)
    #Endif
    }
    #Pop either (a-b) or the 0 we pushed
    {}
    #Push stack-height-1
    ([][()])
#Endwhile
}
#Toggle to the alternate stack and display the counter
<>
```
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 50 bytes
```
(([][()]){[{}]<({}[({})])>{(<{}>)()}{}([][()])}<>)
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/X0MjOjZaQzNWszq6ujbWRqO6NhqIgXy7ag2b6lo7TQ3N2upamKJaGzvN//91jRVAEEgZAAA "Brain-Flak – Try It Online")
```
# Get ready to push the answer
(
# Push stack height - 1
([][()])
# Loop until 0 (until the stack has a height of 1)
{
  # Pop the old stack height and subtract it 
  #(cancels the loop counter from the final answer)
  [{}]
  # Pop the top of the stack and subtract the next element from that
  # Don't include this in the final answer
  <({}[({})])>
  # If not 0
  {
    # Pop the difference between the last two numbers
    # Don't include this in the final answer
    (<{}>)
    # Add 1 to the final answer
    ()
  # End if
  }{}
  # Push stack height - 1
  ([][()])
# End while
}
# Switch to the off stack so we don't print anything extra
<>
# Push the total sum. This is the number of times the if was true
)
```
[Answer]
# [Haskell](https://www.haskell.org/), 35 bytes
*-8 bytes thanks to H.PWiz.*
Out-golfed by a [recursive version](https://codegolf.stackexchange.com/a/146436/68615). Haskell is pretty much the best at recursion and I missed it. >\_<
```
f l=sum[1|x<-zipWith(/=)l$tail l,x]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hx7a4NDfasKbCRrcqsyA8syRDQ99WM0elJDEzRyFHpyL2f25iZp6CrUJuYoGvgkZBUWZeiYKeQpqmQnR0rI5CtAGY0FEwhNJgvqGOgpGOgjFQ1BzKhSAjiDhITNcYrACIQCyD2Nj/AA "Haskell – Try It Online")
It'd be awesome if anybody figured out how to employ [this tip](https://codegolf.stackexchange.com/a/76364/68615).
## Alternate solution, 36 bytes
```
f l=sum[1|True<-zipWith(/=)l$tail l]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P00hx7a4NDfasCakqDTVRrcqsyA8syRDQ99WM0elJDEzRyEn9n9uYmaegq1CbmKBr4JGQVFmXomCnkKapkJ0dKyOQrQBmNBRMITSYL6hjoKRjoIxUNQcyoUgI4g4SEzXGKwAiEAsg9jY/wA "Haskell – Try It Online")
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), 65 bytes
Not as short as I'd like, but that's just Java for you.
Test by passing the array as a comma delimited list.
```
a->{int s=0,i=1;for(;i<a.length;s+=a[i-1]!=a[i++]?1:0);return s;}
```
[Try it online!](https://tio.run/##TY9BT4QwEIXP5VeMeyoBGtCbFT17cC8eSQ@V7WJXKKQtazaE347TuhtNmk5e@@bNNyd5lsU4KXM6fG1tL52DN6nNkhBtvLJH2SrYLwmQoKGjeDcCZMoTsiYJmeaPXrfgvPRYzqM@wIDt9N1bbbroxCjyJ23noAbZlIK5qdee7vJdCCPXYGvlpQajviE8BDvrlen8pwim42gDAWjMKDnop38GlFkWp5GY0miBrlfcolOWTdI6hYKGDvxiSDTQNI5eA@HFeTWwcfZsQlZPDetozElvu16X3IPB3E0Wz0tAcXWZ67riAY0j0I3GZbVsdFGJu1CzTLxUj2XKrfKzNeD4uhGerNtW5fB77uN5@AE "Java (OpenJDK 8) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
ITL
```
[Try it online!](https://tio.run/##y0rNyan8/98zxOf////RhjoKEGQERqZIyNBcR8E4FgA "Jelly – Try It Online")
## How it works
```
ITL  - Full program.
I    - Increments (deltas).
 T   - Get the indices of truthy values (gets the indexes of non-0 elements).
  L  - Length.
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 3 bytes
```
Ltg
```
[Try it online!](https://tio.run/##yygtzv7/36ck/f///9G6xjogCKQMYgE "Husk – Try It Online")
### Explanation
```
Ltg    Input: [1,1,1,2,2,3]
  g    Group equal elements together: [[1,1,1],[2,2],[3]]
 t     Drop the first group (if any): [[2,2],[3]]
L      Return the length of the list: 2
```
[Answer]
# [Ohm v2](https://github.com/MiningPotatoes/Ohm), 3 bytes
```
ΔyΣ
```
[Try it online!](https://tio.run/##y8/INfr//9yUynOL//@P1jXWUYAgEMsgFgA "Ohm v2 – Try It Online")
**Explanation**
```
Δ     absolute differences between consecutive elements
 y    sign: 1 if positive, -1 if negative, 0 if zero
  Σ   sum
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 23 ~~24~~ ~~26~~ ~~29~~ bytes
```
Length@Split@#~Max~1-1&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73zexItonNS@9JMMhuCAns8RBWddQxyBW7X9AUWZeSXRadLWusQ4IAimD2tjY/wA "Wolfram Language (Mathematica) – Try It Online")
* -1 byte thanks to Martin Ender!
* -2 bytes thanks to JungHwan Min! nice use of `Split[]`.
* -3 bytes thanks to totallyhuman!
a little explanation:
`Split` will divide an array into a list of lists (of same elements), that is, turning `{1, 2, 2, 3, 1, 1}` into `{{1}, {2, 2}, {3}, {1, 1}}` . So, `Length@Split@#` is the quantity of consecutive segements. `Max[*****-1, 0]` is used to deal with `{}` input.
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~24~~ ~~21~~ 16 bytes
*Thanks to @MartinEnder for -3 bytes and noticing a bug*  
*-1 byte thanks to @tsh*  
*-4 bytes thanks to @Leo*
```
m`^(\S+)¶(?!\1$)
```
[Try it online!](https://tio.run/##K0otycxL/K@qEZyg8D83IU4jJlhb89A2DXvFGEMVzf//uQy4DBQMgdiAy1DBSMFYwdAcyABBIxCXS9dYAQSBFFCBqYKhKZehEQgqGIEpAA "Retina – Try It Online")
[Answer]
# [Perl 6](https://perl6.org), 18 bytes
```
{sum $_ Z!= .skip}
```
[Test it](https://tio.run/##fY9NTsMwFIT3PsUgIZrQOk1qfiSiAlv2rAgWCsmDRiSOVTsSVcnJ2HGxYldZVLTUs7Ct741nrGlZX22aFc6KRa7eiRdtpyzmm7XpGpy@4Olkjsh8VLr3U/eWjKOoK0UmCKMm1zdrBnhUKQeiom1egylGfHSH53KMafjzHT0om7opNxItKC@Dc56Ek@3V5lU9cTmsZ6wzhEf3fsp0nSuMt2EpY2/tcgjmtwicS3fWeehTU2GpdMeSTBHCF6kML4l0vcLufwZTuO9KWb/JEnjNnC4HJdcQEl8ALlgmcXh5HLMslscxEvkfTjyO5RG3ryVcHXkAC7bTXMi/eMYyLuDltngPi18 "Perl 6 – Try It Online")
## Expanded:
```
{ # bare block lambda with implicit parameter ｢$_｣
  sum         # count the number of True values
      $_      # the input
    Z!=       # zip using &infix:«!=»
      .skip   # the input, but starting from the second value
              # (implicit method call on ｢$_｣
}
```
[Answer]
# [Symbolic Python](https://github.com/FTcode/Symbolic-Python), ~~120~~ 117 bytes
Golfed 3 bytes by removing an explicit cast to integer (using unary `+`) for the counter variable - this means that if there are no changes in the array the output will be `False` instead of `0`, but this is [allowed by meta](https://codegolf.meta.stackexchange.com/a/9067/60919).
```
___=-~(_==_)
__('___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)')
__('__=___=_>_'+';___+=_[__]!=_[-~__];__=-~__'*___)
_=___
```
[**Try it online!**](https://tio.run/##NY2xDoMwDET3fkU7OTRkoiwg90dQdIguIJVSqSws@XX3EgnpZPvsd/LvWKftvbzC99jn7WMGQENyUEV1AZzkRQriRzwxDnRdxxLpaUMqszhUcuKaE4TFS8/RK5iKN7ZMx748AOTOIzMZN7Ohqa/Uo6g91cQ/ "Symbolic Python – Try It Online")
```
# LINE 1: Generate value '2' for utility
___=-~(_==_)
# LINE 2: Get len(input) - 1
__('___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)')
   '___=~-'+`_>_`[___::___]+`__`[-~___]+'(_)'     # Generate string '___=~-len(_)'
            `_>_`[___::___]                       #    'le' spliced from 'False'
                           +`__`[-~___]           #    'n' indexed from '<function ...>'
   '___=~-'+                           +'(_)'     #    Remaining characters in plaintext
__(                                          )    # Execute this to get len(input) - 1
# LINE 3: Main calculation loop
__('__=___=_>_'+';___+=_[__]!=_[-~__];__=-~__'*___) 
__(                                               ) # Execute:
   '__=___=_>_'                                     #   Set var1, var2 to 0
               +';                           '*___  #   len(input) - 1 times do:
                       _[__]!=_[-~__]               #   Compare input[var1, var1 + 1]
                  ___+=              ;              #   Add this to var2
                                      __=-~__       #   Increment var1
# LINE 4: Set output variable ('_') to the result calculated.
_=___                                       
```
[Answer]
# Elm, 59 bytes
```
f x=case x of
 a::b::c->f(b::c)+if a/=b then 1 else 0
 _->0
```
You can test this out [here](https://elm-lang.org/try). Paste the following code to get started:
```
import Html exposing (text)
f x=case x of
 a::b::c->f(b::c)+if a/=b then 1 else 0
 _->0
main = 
  f [0,0,1,0]
  |> Debug.toString
  |> text
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 3 bytes
```
¥ĀO
```
[Try it online!](https://tio.run/##MzBNTDJM/f//0NIjDf7//0cb6ihAkBEYGccCAA "05AB1E – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
#IẊ≠
```
[Try it online!](https://tio.run/##yygtzv7/X9nz4a6uR50L/v//H61rrAOCQMogFgA "Husk – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 24 bytes
```
cat(sum(!!diff(scan())))
```
[Try it online!](https://tio.run/##K/r/PzmxRKO4NFdDUTElMy1Nozg5MU9DEwj@GyoYKRgrmCiYgqHZfwA "R – Try It Online")
Same as the MATL answer, just used `sum(!!diff))` since there's no `nnz`.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 24 bytes
```
UpO@0I>I!^-u>q.uvv$!^;)p
```
[Try it online](https://ethproductions.github.io/cubix/?code=ICAgIFUgcAogICAgTyBACjAgSSA%20IEkgISBeIC0gdQo%20IHEgLiB1IHYgdiAkICEKICAgIF4gOwogICAgKSBwCg==&input=LTMgMyAzIC0zIDE=&speed=5)
Note that Cubix uses 0 to indicate that there are no more inputs, so 0 cannot be in the list.
### Explanation
Unfolded:
```
    U p
    O @
0 I > I ! ^ - u
> q . u v v $ !
    ^ ;
    ) p
```
We start at the `0`, pushing the counter (initialized with `0`) and the first input (`I`) onto the stack.
We then enter the loop. At each iteration of the loop, we get the next input with `I`. If it's 0, we've run out of inputs, so we rotate the counter to the top (`p`), `O`utput, and exit (`@`).
Otherwise, we take the difference of the top two elements. If it's nonzero, we rotate the counter to the top, increment it, and rotate it back to the bottom with `p)q`. We then pop the difference with `;` before moving to the next iteration.
All the characters not mentioned here are just control flow. There tend to be a lot of those in Cubix programs.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 8 bytes
```
+/2≠/⊃,⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wRtfaNHnQv0H3U16zzqWgQUUzDgAmIFQzAJYhsqGCkYKxiag5mGYC5QAMg7tN5YAQRBtAEA "APL (Dyalog Unicode) – Try It Online")
**How?**
`⊃,⊢` - the list, with the first value repeated for the case of single element
`2≠/` - changes list, not equal for every 2 elements
`+/` - sum
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 50 bytes
```
(([][()]){[{}({}[({})])]{{}()(<()>)}{}([][()])}<>)
```
[Try it online!](https://tio.run/##SypKzMzTTctJzP7/X0MjOjZaQzNWszq6ulajujYaiIG82GogT1PDRkPTTrMWyIQqqrWx0/z/31ABBI2A0AQIjQE "Brain-Flak – Try It Online")
Since everyone is posting their 50 byte solutions here is mine (I have a [48 byte one](https://tio.run/##SypKzMzTTctJzP7/XyM6OjZWQ1OzWqO6VkPTBkhGA7FmrGZ1da2NHVhQU8PGTrO2uhZI2Nj9/2@oAIJGQGgKhYbmCsYA "Brain-Flak – Try It Online") but it was a simple modification of DjMcMayhem's so I did feel it worth posting)
# Explanation
This answer extensively uses value canceling.
Un-golfed it looks like
```
([][()])({<{}({}[({})])>{<{}>()(<()>)}{}<([][()])>}<>)
```
Here we compute the delta's until the stack has one item left, each time we accumulate one value from the inner loop if the delta is non zero.
This is a pretty straight forward way of doing it.
To make this golfy we begin value canceling. The first one and the one that should be obvious to any hardened brain-flak golfer is the stack heights. It is a well known fact that
```
([])({<{}>...<([])>}{})
```
is the same as
```
(([]){[{}]...([])}{})
```
When the values are modified by one, the same holds. This gives us
```
(([][()]){[{}]<({}[({})])>{<{}>()(<()>)}{}([][()])}<>)
```
You may notice this didn't even save us bytes, but don't fret it will become more useful as we go on.
We can perform another reduction, if you see a statement
```
<(...)>{<{}> ...
```
you can actually reduce it to
```
[(...)]{{} ...
```
This works because if we enter the loop `[(...)]` and `{}` will cancel, and if we don't the value of `[(...)]` already was zero in the first place and doesn't need to be canceled. Since we have an occurrence of this pattern in our code we can reduce it.
```
(([][()]){[{}][({}[({})])]{{}()(<()>)}{}([][()])}<>)
```
That saved us 2 bytes but it also put two negs next to each other. These can be combined to save us another 2.
```
(([][()]){[{}({}[({})])]{{}()(<()>)}{}([][()])}<>)
```
And that's our code.
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 2 bytes
```
ėl
```
[Try it online!](https://tio.run/##S0/MTPz//8j0nP@pj9om/o/WNVYAQSBlEAsA "Gaia – Try It Online")
This abuses a bug (or feature?) of Gaia, that run-length-encoding doesn't take the last run of elements into account. Note that I have double checked, it works for all test cases.
* `ė` - Run length encoding (with the flaw described above).
* `l` - Length.
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~52~~ 45 bytes
*(-7 bytes thanks to Julian)*
```
$i=0
$args|%{$i+=$p-ne$_-and$p-ne$n
$p=$_}
$i
```
[Try it online!](https://tio.run/##XZBBS8NAEIXP2V8xh9EmuAtpcvAgC4GCV8V6EwkxndqUmMTsBoU0vz3OupXaLrMw8977ZmG79ot6s6O6nnGrxxkrHQss@ndzuBqxutHYqYYwV0Wz8W0jsNOYTwKreRIiCwXwkVmYhZGEODqN8eUsYRm5eyZdppYSEgkp527ZSc8dX4mPsJ38s1X6i3G5LvZwBAe4b3sqyp16eNtTaWEUAVoyVgLSd8cKbUAD5iz3ZIba8nSNW8hcSAQvj@vVYGz74fHXjPlgPZQlGeO4I6Po87TvjiPPTK8KQy7jNoHat1UDCwkLZz/9PXVcwNok@D/n@Qc)
Takes input `$args`, dumps it into a for loop, each iteration checking whether the `$p`revious value is `-n`ot`e`qual to the current value `$_`, and whether the previous value is `$n`ull. Exploits the Boolean-to-int implicit converstion to accumulate that into `$i`. Outputs `$i` at the end.
The initial `$i=0` is needed to account for if the input is empty, and to (properly) account for when the input is a single value.
[Answer]
## JavaScript (ES6), 35 bytes
```
a=>a.filter((e,i)=>e-a[i+1]).length
```
[Answer]
# Pyth, 5 bytes
```
l #.+
```
[Test suite.](http://pyth.herokuapp.com/?code=l+%23.%2B&test_suite=1&test_suite_input=%5B%5D%0A%5B0%5D%0A%5B0%2C+1%5D%0A%5B0%2C+0%5D%0A%5B1%2C+2%2C+3%2C+17%5D%0A%5B1%2C+1%2C+1%2C+2%2C+2%2C+3%5D%0A%5B-3%2C+3%2C+3%2C+-3%2C+0%5D&debug=0)
Explanation:
```
   .+  Deltas
  #    Filter on identity (space)
l      Get length 
```
[Answer]
# [Perl 5](https://www.perl.org/), 37 + 2 (`-ap`) = 39 bytes
```
$\+=$F[$_]!=$F[$_-1]for 1..$#F}{$\|=0
```
[Try it online!](https://tio.run/##K0gtyjH9/18lRttWxS1aJT5WEULrGsam5RcpGOrpqSi71VarxNTYGvz/b6gAgkZAaPwvv6AkMz@v@L9uYgEA "Perl 5 – Try It Online")
[Answer]
# J, 10 bytes
```
[:+/2~:/\]
```
Infixes of length 2... are they unequal? `2 ~:/\ ]`
Sum the resulting list of `0`s and `1`s: `+/`
[Try it online!](https://tio.run/##y/qfVqxga6VgoADE/6OttPWN6qz0Y2L/a3Ip6Smop9laqSvoKNRaKaQVc3GlJmfkA1XaKqQpGEA4hhCOgiGKHEzWGMw1VDACsgzNIWJGUDFDsDhQBllpvLECCAIpg/8A "J – Try It Online")
[Answer]
# Pyth, 4 bytes
```
ltr8
```
[Test suite](https://pyth.herokuapp.com/?code=ltr8&test_suite=1&test_suite_input=%5B1%2C1%2C1%2C2%2C2%2C5%2C5%2C5%2C5%2C17%2C3%5D%0A%5B%5D%0A%5B0%5D%0A%5B0%2C1%5D%0A%5B0%2C0%5D%0A%5B1%2C2%2C3%2C17%5D%0A%5B1%2C1%2C1%2C2%2C2%2C3%5D%0A%5B-3%2C3%2C3%2C-3%2C0%5D&debug=0)
"literate"
The number of changes is equal to the number of runs, ignoring the first run if any. `r8` run length encodes the input, `t` removes the first element if any, and `l` finds the length of the resulting list.
]