#include <bits/stdc++.h>
using namespace std;
long n, l[100005], r[100005];
long long ans = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  ans = n;
  for (long i = 1; i <= n; ++i) cin >> l[i] >> r[i];
  sort(l + 1, l + 1 + n);
  sort(r + 1, r + 1 + n);
  for (long i = 1; i <= n; ++i) {
    ans += max(l[i], r[i]);
  }
  cout << ans;
  return 0;
}
