Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim x As Integer = NextInt()
        Dim y As Integer = NextInt()

        Dim cnt As Integer = Integer.MaxValue

        For i As Integer = 1 To 4
            cnt = Math.Min(cnt, Solve(i, x, y))
        Next

        WriteLine(cnt)
    End Sub

    Function Solve(i As Integer, x As Integer, y As Integer) As Integer
        Dim cnt As Integer

        If i Mod 2 = 0 Then
            x *= -1
            cnt += 1
        End If

        If i <= 2 Then
            y *= -1
            cnt += 1
        End If

        If x <= y Then Return cnt + y - x
        Return Integer.MaxValue
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module
