A race is organized among N horses of a kingdom. Every horse has a velocity (in m/sec) that is denoted by an array Velocity[ ] where Velocity[i] represents the velocity of the ith horse. The indexing of the array is 0-based.
All the horses are standing at different starting positions. The starting position of every horse is represented by an array pos[ ] where pos[i] denotes the starting position of the ith horse. The indexing of the array is 0-based. The pos[ ] array is a permutation of integers 1 to N. A horse who is standing at i position is considered to be ahead of the horse who is standing at position j if and only if i>j.
The finish line of the race is 10100000 meters ahead. An overtake occurs when horse A, whose starting position is less than horse B, finishes the race earlier than horse B. Your task is to determine the number of overtakes that has occurred during the race.
Input format
Output format
Print a single integer denoting the number of overtakes that has occurred during the race.
Horse at start point 1 will overtake Horse at start point 2. Horse at start point 3 will overtake Horse at start point 4.