program main implicit none integer(8):: n, i, ans integer:: x(1:200000) integer, allocatable:: a(:) read (*, *) n allocate(a(n)) read (*, *) a(1:n) do i = 1, n x(a(i)) = 1 end do do i = 199998, 1, -1 if (x(i) > 0) then x(i) = x(i) + x(i + 2) end if end do ans = n do i = 2, 200000 if (x(i - 1) > 0 .and. x(i) > 0) then ans = ans + x(i) end if end do write (*, '(i0)') ans end program main