MetroCity

4

1 votes
Medium-Hard
Problem

In Metro city, there are N Metro stations. A Train can travel from one station to another iff the two stations are connected.

Two Metro stations are directly connected to each other iff the Metro station having a station number j is at a Lower height than that of a Metro station having a station number i where ( i< j ).

SInce the State department has a shortage of funds. Only one train is allowed for a particular set of connected stations. Each Train has a fixed number of Compartments. The number of compartments in a train are given by the number of divisors of the number of connected stations it can travel to.

You have been hired by Transportation department to count the Total number of compartments required. Write a code to automate the process!

Input

First line contains a number N,

Second line contains an array of Heights of N Metro Stations.

Constraints

1<=N<=5*10^5

1<=Array[i]<=10^9

Output

Print one number. The Total Number of Compartments required.

Sample Input
5
1 41 2 50 3
Sample Output
4
Time Limit: 1.5
Memory Limit: 256
Source Limit:
Explanation

The Total number of stations are 5.

Heights - 1 41 2 50 7 are the heights of the stations.

Station No. - 1 2 3 4 5. We can see that Station Number (2,3) , (4,5) and (2,5) are directly connected.

Thus, {2,3,4,5} and {1} are two separate set of connected stations.

The number of compartments are div(4) + div(1) = 3+1 ( Sum of number of divisors )

Editor Image

?