#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;
const int MAXN = 1e6 + 10, MAXQ = 3e5 + 10, MAXL = 20, ALP = 26,
          MOD = 998244353, MAXK = 17, MAXA = 30, MAXB = 24, MAXBB = (1 << MAXB);
const string no = "NO\n", yes = "YES\n";
const int hA[4] = {1, 0, -1, 0}, kA[4] = {0, 1, 0, -1};
const long long INF = 1e18 + 10;
void solve() {
  int n;
  cin >> n;
  vector<long long> l(n), r(n);
  for (int i = 0; i < n; i++) cin >> l[i] >> r[i];
  sort(l.begin(), l.end()), sort(r.begin(), r.end());
  long long ans = n;
  for (int i = 0; i < n; i++) ans += max(l[i], r[i]);
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t_c = 1;
  while (t_c--) solve();
}
