eolymp
bolt
Try our new interface for solving problems
Problems

Increasing subsequence

Increasing subsequence

A sequence of integers is given. Find the number of its increasing subsequences.

Input

First line contains the length of a sequence n (1n500). Second line contains all its elements (positive integers, less than 5000).

Output

Print the number of its increasing subsequences.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
1 2 3
Output example #1
7
Input example #2
3
3 1 2
Output example #2
4