NumberEater is a famous monster from Byteland. It eats numbers, but it is very picky: every day its meal must be unique. The monster is given a sequence of integers a1,a2,…,an. It chooses a start position i and an end position j (1≤i≤j≤n) and prepares a meal made of the elements ai,ai+1,…,aj.
The monster considers two meals [i1,j1] and [i2,j2] to be identical when they contain the same set of numbers, that is:
{ak:i1≤k≤j1}={ak:i2≤k≤j2}
Help NumberEater count how many different meals it can prepare using the sequence a.
The first line contains one integer n (1≤n≤500), the length of the sequence a. Each of the next n lines contains one element of the sequence. Every element is at least 1 and at most 500.
Print a single integer: the number of different meals that NumberEater can prepare.