//package zlatniciboljipokusaj;

import java.util.Arrays;
import java.util.Scanner;

public class ZlatniciBoljiPokusaj {
    
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        
        
        int [] nizx = new int[n];
        
        int [] nizy = new int[n];
        
        int [] y = new int[n];
        int [] x = new int[n];
        
        for (int i = 0; i < n; i++) {
            nizx[i] = i+1;
            nizy[i] = i+1;
            
            x[i] = in.nextInt();
            y[i] = in.nextInt();
        }
        
        Arrays.sort(x);
        Arrays.sort(y);
        
        int suma = 0;
        
        for (int i = 0; i < n; i++) {
            nizx[i] -= x[i];
            nizy[i] -= y[i];
        }
        
        
        for (int i = 0; i < n; i++) {
            if(nizx[i]<0){
                suma -= nizx[i];
            }else{
                suma += nizx[i];
            }
            
            if (nizy[i]<0) {
                suma -= nizy[i];
            }else{
                suma += nizy[i];
            }
        }
        
        System.out.println(suma);
    }
    
}