#include <bits/stdc++.h>
using namespace std;
const int MAXN = 112345;
long long l[MAXN], r[MAXN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%lld %lld", l + i, r + i);
  sort(l, l + n);
  sort(r, r + n);
  long long ans = n;
  for (int i = 0; i < n; ++i) ans += max(l[i], r[i]);
  cout << ans << endl;
  return 0;
}
