AT_arc206_a [ARC206A] Range Replace

Description

You are given a sequence $ A=(A_1,\ldots,A_N) $ of length $ N $ . You perform the following operation exactly once. - Choose a pair of integers $ (L,R) $ such that $ 1\leq L \leq R \leq N $ . Replace each of $ A_L,A_{L+1},\ldots,A_R $ with $ A_L $ . How many different sequences are possible as $ A $ after the operation?

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ \ldots $ $ A_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 The possible sequences after the operation are the following four sequences: - $ (1,1,1,1) $ - $ (1,1,1,3) $ - $ (1,1,2,2) $ - $ (1,1,2,3) $ For example, $ (1,1,1,3) $ can be obtained by performing the operation with $ L=2,R=3 $ . ### Constraints - All input values are integers. - $ 1 \leq N \leq 10^6 $ - $ 1\leq A_i \leq N $