#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)2e5 + 2;
const long long mod = (long long)1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long l[n], r[n];
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  sort(l, l + n);
  sort(r, r + n);
  long long res = n;
  for (long long i = 0; i < n; i += 1) {
    res += max(l[i], r[i]);
  }
  cout << res;
  return 0;
}
