# Minimum Deletions To Make Sorted Array

easy

1. You are given a number N representing number of elements. 2. You are given N space separated numbers representing (ELE)elements. 3. Find the minimum number of deletions/removals needed such that remaining elements are (strictly)sorted.

## Constraints

1 <= N <= 100000 1 <= Elei <= 50000

## Format

### Input

A number N(number of elements) ELE1 ,ELE2 ,ELE3 ,ELE4 ,ELE5 .... ELEn (N space separated elements)

### Output

Find the minimum number of deletions/removals. Check the sample output and question video.

## Example

Sample Input

10
40 10 55 18 14 41 61 62 25 50

### Sample Output

5