#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int MAXN = 1e5 + 5;
long long int fastexpo(long long int b, long long int exp) {
  if (exp == 0) return 1;
  if (exp == 1) return b;
  long long int ans = (fastexpo(b, exp / 2) % MOD);
  ans *= ans;
  ans %= MOD;
  if (exp % 2 == 1) {
    ans *= b;
  }
  ans %= MOD;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> low, high;
  for (long long int i = 0; i < n; i++) {
    long long int t1, t2;
    cin >> t1 >> t2;
    low.push_back(t1);
    high.push_back(t2);
  }
  sort(low.begin(), low.end());
  sort(high.begin(), high.end());
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    ans += max(low[i], high[i]);
  }
  cout << ans + n << endl;
  return 0;
}
