#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, i, s;
  vector<long long> l, r;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    l.push_back(a);
    cin >> a;
    r.push_back(a);
  }
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  s = 0;
  for (i = 0; i < n; ++i) {
    s += 1 + max(l[i], r[i]);
  }
  cout << s;
  return 0;
}
