N = int(input())
H = list(map(int, input().split()))
cnt = 1

for i in range(0, N):
  for j in range(i+1):
    print(H[i], H[j])
    if H[i] <= H[j]:
      if i == j:
        cnt += 1
      else:
        continue
    else:
      break
        
print(cnt)