#include <bits/stdc++.h>
using namespace std;
long long leftt[100010], rightt[100010];
int main() {
  long long n;
  cin >> n;
  long long ans = n;
  for (long long i = 0; i < n; i++) {
    cin >> leftt[i] >> rightt[i];
  }
  sort(leftt, leftt + n);
  sort(rightt, rightt + n);
  for (long long i = 0; i < n; i++) {
    ans += max(leftt[i], rightt[i]);
  }
  cout << ans << "\n";
  return 0;
}
