How many fingers does bad pianist need? Challenge

Premise

Bob is a novice pianist who can only play sequences of single notes. In addition, he does quite an interesting thing: for every note after the first, if it's higher than the previous note was, he uses the finger directly to the right of the previous finger used; if lower, to the left; if the same pitch, well, the same finger.

Let's take Auld Lang Syne as an example, and arbitrarily suppose, only for the sake of this example, that Bob uses the very right side of his right hand.

Pitch: Should &lt; auld = ac- = quain- &lt; tance &gt; be &gt; for- &lt; got
Digit: mid      ring   ring  ring     pinky   ring mid    ring


Alice wants to convince him of the stupidity of his playing...

Task

Input: a sequence of \$n\$ MIDI note numbers (which are integers between 0 and 127 inclusive), where \$2\leq n\leq10000\$.

Output: the number of fingers required to finish the melody with the playing style outlined in 'Premise'.

Please note that the answer may be more than 5.

No consideration of the starting finger is needed. Assume that the choice is optimal for playable melodies and has nothing (else) to do with the number of fingers required.

Example 1

Input: 0 0 0 0

Output: 1

Example 2

Input: 43 48 48 48 52 50 48 50

Output: 3

Example 3

Input: 86 88 84 81 83 79 74 76 72 69 71 67 62 64 60 57 59 57 56 55

Output: 9

Example 4

Input: 82 79 78 76 78 76 74 73 70 67 66 64 66 64 62 61

Output: 12

Remarks


This is code-golf, so fewest bytes wins.
Standard rules, I/O rules and loophole rules apply.
If possible, link an online demo of your code.
Please explain your code.
Perl 6, 27 bytes

{+minmax [\+] @_ Z&lt;=&gt;0,|@_}

Try it online!
Explanation
@_ Z&lt;=&gt;0,|@_ uses the zip metaoperator (Z) with the compare operator (&lt;=&gt;) to zip the list with itself offset by 1 and return the result of the comparison., e.g. [43, 48, 48, 48, 52, 50, 48, 50] -&gt; (More More Same Same More Less Less More)
[\+] Reduces the list by summing over it (More = 1, Same = 0, Less = -1), however the \ does a 'triangular reduction' which produces a list of each calculation instead of the end result, e.g. (More More Same Same More Less Less More) -&gt; (More 2 2 2 3 2 1 2)
minmax returns the range of smallest..largest, effectively removing duplicates. (More 2 2 2 3 2 1 2) -&gt; Order::More..3
+ just returns the length of this range (list), which is the result