n = int(input())
l = [int(x) for x in input().split()]
max_h = l[0]
result = 1
for i in range(1,n):
    print(max_h, l[i])
    if max_h <= l[i]:
        result += 1
        max_h = l[i]
    else:
        continue
print(result)