program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) k
    a=k
    do i=1,100
        a=a/2
        if(a==0)then
            a=i
            exit
        endif
    end do
    write(*,*)2**a-1

    stop
end program sample
  

