#include <bits/stdc++.h>
using namespace std;
int bi[100005], ai[100005];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> ai[i] >> bi[i];
  }
  sort(ai + 1, ai + n + 1);
  sort(bi + 1, bi + n + 1);
  for (int i = 1; i <= n; i++) {
    sum += max(ai[i], bi[i]);
  }
  cout << sum + n << endl;
  return 0;
}
