from itertools import permutations
def d(s,e):
d=0
while s!=e:
x=1 if s[0]<e[0] else -1 if s[0]>e[0] else 0
y=1 if s[1]<e[1] else -1 if s[1]>e[1] else 0
s=(s[0]+x,s[1]+y)
d+=(1,1.5)[x and y]
return d
l,m=4,0
for o in permutations([(1,1),(2,2),(3,3)]):
a,c=l-d((0,0),o[0]),1
for j in range(len(o)-1):
a-=d(o[j],o[j+1])
c+=(0,1)[a>0]
m=max(c,m)
print m
ZnJvbSBpdGVydG9vbHMgaW1wb3J0IHBlcm11dGF0aW9ucwpkZWYgZChzLGUpOgogICAgZD0wCiAgICB3aGlsZSBzIT1lOgogICAgICAgIHg9MSBpZiBzWzBdPGVbMF0gZWxzZSAtMSBpZiBzWzBdPmVbMF0gZWxzZSAwCiAgICAgICAgeT0xIGlmIHNbMV08ZVsxXSBlbHNlIC0xIGlmIHNbMV0+ZVsxXSBlbHNlIDAKICAgICAgICBzPShzWzBdK3gsc1sxXSt5KQogICAgICAgIGQrPSgxLDEuNSlbeCBhbmQgeV0KICAgIHJldHVybiBkCmwsbT00LDAKZm9yIG8gaW4gcGVybXV0YXRpb25zKFsoMSwxKSwoMiwyKSwoMywzKV0pOgogICAgYSxjPWwtZCgoMCwwKSxvWzBdKSwxCiAgICBmb3IgaiBpbiByYW5nZShsZW4obyktMSk6CiAgICAgICAgYS09ZChvW2pdLG9baisxXSkKICAgICAgICBjKz0oMCwxKVthPjBdCiAgICBtPW1heChjLG0pCnByaW50IG0=