I,R=input,range N,T=R(int(I())),R(1,301) X=[list(map(int,I().split()))for i in N] print(min([sum([abs(z[0]-x)+abs(z[1]-y)for z in X])for x,y in zip(T,T)]))