#### Registered Users Only

Please login to view and utilize this feature.

## Problem Description

Gug has a random array *A* of length *N*. A subarray of *A* is defined as a *slope* if all its elements, when read from left to right, are in **strictly** ascending or **strictly** descending order.

Gug, for some reason, wants to cut *A* into smaller consecutive subarrays, such that each of these subarrays is a *slope*. Help him find the minimum number of cuts he has to make for this to happen.

## Limits

For all tests: 1 ≤ A_{i} ≤ 10^{9}.

Subtask 1 (22%): 1 ≤ N ≤ 1000.

Subtask 2 (24%): 1 ≤ N ≤ 200000, 1 ≤ A_{i} ≤ 2.

Subtask 3 (26%): 1 ≤ N ≤ 200000, A_{i} ≠ A_{j} if i ≠ j.

Subtask 4 (28%): 1 ≤ N ≤ 200000.

Subtask 5 (0%): Sample Testcases.

## Input

The first line of input will contain one integer, *N*.

The second line of input will contain *N* integers, representing the array *A*.

## Output

The only line of output should contain one integer, the minimum number of cuts Gug has to make.

## Sample Testcase 1

### Input

5 9 5 3 2 1

### Output

0

## Sample Testcase 2

### Input

5 1 2 3 2 1

### Output

1

## Sample Testcase 3

### Input

6 1 2 3 3 2 1

### Output

1

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 22 | 23 | 0.5s | 256MB | Minimum |

2 | 24 | 20 | 0.5s | 256MB | Minimum |

3 | 26 | 21 | 0.5s | 256MB | Minimum |

4 | 28 | 83 | 0.5s | 256MB | Minimum |

5 | 0 | 3 | 0.5s | 256MB | Minimum |

### Judge Compile Command

g++ ans.cpp -o slopes -Wall -static -O2 -lm -m64 -s -w -std=gnu++14 -fmax-errors=512