vertigo

TimeLimit:1000MS  MemoryLimit:128MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

The shame question let tutu feel vertigo, then you?

You are given a sequence a = (a1, ......, aN) of length N consisting of integers between 1 and N.

Find the number of pair of integers i, j that satisfy all of the following conditions;

· 1 <= i < j <= N

· min(ai,  aj) = i

· max(ai,  aj) = j


2 <= N <= 10000

1 <= ai <= N

all values in input are integers


Input

N

a1 ... aN

Output

answer

SampleInput
10
5 8 2 2 1 6 7 2 9 10
SampleOutput
8
Submit
题目统计信息详细
总AC数63
通过人数56
尝试人数61
总提交量119
AC率47.06%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: