#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> l(n);
  vector<long long> r(n);
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  long long chairs = n;
  for (long long i = 0; i < n; i++) {
    chairs += max(l[i], r[i]);
  }
  cout << chairs << endl;
  return 0;
}
