program Exactly_N_points
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,ex,up
    integer(int32), allocatable:: cs(:)

    read*, n
    allocate(cs(n))
    cs(1) = 1
    ex = 0
    up = 1
    do i=2,n
        cs(i) = cs(i-1)+i
        if (cs(i) >= n) then
            ex = cs(i) - n
            up = i
            exit
        end if
    end do

    do i=1,up
        if (i==ex) cycle
        print'(i0)', i
    end do
end program Exactly_N_points