#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long dist(pair<long long, long long> a, pair<long long, long long> b) {
  return (abs(a.first - b.first) + abs(a.second - b.second));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long a, b;
  map<long long, pair<long long, long long> > s;
  map<long long, pair<long long, long long> > e;
  map<long long, pair<long long, long long> >::iterator its;
  map<long long, pair<long long, long long> >::iterator ite;
  map<long long, pair<long long, long long> >::iterator itsp;
  map<long long, pair<long long, long long> >::iterator itep;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    if (s.find(max(a, b)) == s.end()) {
      s[max(a, b)] = make_pair(a, b);
      e[max(a, b)] = make_pair(a, b);
    } else {
      if (a < s[max(a, b)].first ||
          (a == s[max(a, b)].first && b > s[max(a, b)].second))
        s[max(a, b)] = make_pair(a, b);
      if (b < e[max(a, b)].second ||
          (b == e[max(a, b)].second && a > e[max(a, b)].first))
        e[max(a, b)] = make_pair(a, b);
    }
  }
  long long dps = 0, dpe = 0, t1, t2;
  for (its = s.begin(), ite = e.begin(); its != s.end(); its++, ite++) {
    long long k = dist((*its).second, (*ite).second);
    if (its == s.begin()) {
      dps = abs((*ite).second.first) + abs((*ite).second.second) + k;
      dpe = abs((*its).second.first) + abs((*its).second.second) + k;
    } else {
      t1 = k + min(dps + dist((*itsp).second, (*ite).second),
                   dpe + dist((*itep).second, (*ite).second));
      t2 = k + min(dps + dist((*itsp).second, (*its).second),
                   dpe + dist((*itep).second, (*its).second));
      dps = t1;
      dpe = t2;
    }
    itsp = its;
    itep = ite;
  }
  cout << min(dps, dpe);
  return 0;
}
