Bubble Sort
Tag(s):

## Algorithms, Basic Programming, Bubble Sort, Input/Output, Sorting

Problem
Editorial
Analytics

You are given arrays $a_1, a_2, …, a_n$. What will return the next function $Bubble\ Sort\ (A)$ in the next picture.

Input format

• The first line contains the integer $N$ ($1 ⩽ N ⩽ 5000$) denoting the number of elements of array $A$.
• The second line contains $N$ positive integers ($1 ⩽ A_i ⩽ N$) denoting the elements of the array.
Note: It is guaranteed that all elements of array $A$ are different.

Output format

Print an integer that denotes the answer to the question.

SAMPLE INPUT
5
1 3 2 5 4

SAMPLE OUTPUT
2

Explanation

Answer is 2 (to verify this, you can simply implement this procedure)

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, C++17, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, Java 14, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, Python 3.8, R(RScript), Racket, Ruby, Rust, Scala, Swift-4.1, Swift, TypeScript, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in Challenge Name

June Circuits '20

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Dynamic Programming