You are given an array Arr that contains N integers. In one step, you can pick an element from position p and place it before or after some other elements. For example, if you are given an array ={}, then you can pick and place it after . Therefore, the updated array is ={}.
Your task is to determine the minimum number of steps that is required to sort the data in increasing or decreasing order.
Input format
Output format
Print a single integer value that denotes the minimum number of steps that is required to sort the data in increasing or decreasing order.
Constraints
Given Arr[]={1,3,2} . For increasing order sorted data Arr will be {1,2,3}, steps required is 1. For decreasing order sorted data Arr will be {3,2,1}, steps required is 1. So minimum steps are 1.