input()
get_data = input().split(' ')  # String
default = 1
dup_list = list()
for v in get_data:
  if int(v) == default:
    dup_list.append(int(v))
  default += 1

print(dup_list)

del_count = 0
next_skip = False
for v in dup_list:
  if next_skip:
    next_skip = False
    continue
  if v+1 in dup_list:
    next_skip = True
  del_count += 1
  
print(del_count)