#include using namespace std; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, x, y, ret; vector> volcanoes; ret = 0; cin >> n; while(n--) { cin >> x >> y; volcanoes.push_back(make_pair(x, y)); } sort(volcanoes.begin(), volcanoes.end()); x = volcanoes[0].first; y = volcanoes[0].second; for(auto i : volcanoes) { ret += abs(i.first - x); ret += abs(i.second - y); x = i.first; y = i.second; } cout << ret << '\n'; return 0; }