import sys l1 = [] l2 = [] for l in sys.stdin: l = [int(x) for x in l.split()] l1.append(l[0]) l2.append(l[1]) l1.sort() l2.sort() s = 0 for i in range(len(l1)): s += abs(l1[i] - l2[i]) print(s)