#include <bits/stdc++.h>
using namespace std;
bool prime[1000001];
const double gr = 1.6180339887;
void SieveOfErat(long long int mn) {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i <= mn; i++) {
    if (prime[i] == true) {
      for (long long j = i * 2; j <= 1000000; j += i) prime[j] = false;
    }
  }
}
long long int num;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> num;
  vector<long long int> v(num);
  vector<long long int> v1(num);
  for (long long int i = 0; i < num; i++) {
    cin >> v[i] >> v1[i];
  }
  sort(v.begin(), v.end());
  sort(v1.begin(), v1.end());
  long long int val = num;
  for (long long int i = 0; i < num; i++) {
    if (v[i] >= v1[i])
      val = val + v[i];
    else
      val = val + v1[i];
  }
  cout << val << endl;
  return 0;
}
