#include <bits/stdc++.h>
template <class T>
void setmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void setmin(T &a, T b) {
  if (b < a) a = b;
}
using namespace std;
void read(long long &x) { scanf("%lld", &x); }
void read(long long &x, long long &y) { scanf("%lld %lld", &x, &y); }
void read(long long &x, long long &y, long long &z) {
  scanf("%lld %lld %lld", &x, &y, &z);
}
void read(long long &x, long long &y, long long &z, long long &w) {
  scanf("%lld %lld %lld %lld", &x, &y, &z, &w);
}
void read(vector<long long> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    read(oneD[i]);
  }
}
void read(vector<vector<long long> > &twoD) {
  for (long long i = 0; i < twoD.size(); i++) {
    read(twoD[i]);
  }
}
void write(vector<long long> &oneD) {
  for (long long i = 0; i < oneD.size(); i++) {
    printf("%lld ", oneD[i]);
  }
  printf("\n");
}
void write(vector<vector<long long> > &twoD) {
  for (long long i = 0; i < twoD.size(); i++) {
    write(twoD[i]);
  }
}
void write(vector<pair<long long, long long> > &oneDP) {
  for (long long(i) = 0; (i) < (oneDP.size()); ++(i)) {
    printf("%lld %lld\n", oneDP[i].first, oneDP[i].second);
  }
  cout << "\n";
}
void write(map<long long, long long> &mpp) {
  for (map<long long, long long>::iterator it = mpp.begin(); it != mpp.end();
       it++) {
    cout << it->first << " : " << it->second << '\n';
  }
  cout << '\n';
}
bool cmp(const pair<long long, long long> &a,
         const pair<long long, long long> &b) {
  if (a.first == b.first) return (a.second >= b.second);
  return (a.first < b.first);
}
long long A[100005];
vector<long long> seive;
vector<long long> primes;
void Seive() {
  const long long maxn = 100005;
  seive.resize(maxn);
  for (long long(i) = 0; (i) < (maxn); ++(i)) seive[i] = 1;
  for (long long i = 2; i * i < maxn; i++) {
    if (seive[i] == 1) {
      for (long long j = i * i; j < maxn; j += i) {
        seive[j] = 0;
      }
    }
  }
  primes.push_back(2);
  for (long long i = 3; i < maxn; i += 2) {
    if (seive[i]) primes.push_back(i);
  }
}
void printprime(long long l, long long r) {
  if (l < 2) l = 2;
  bool isprime[r - l + 1];
  for (long long(i) = 0; (i) < (r - l + 1); ++(i)) isprime[i] = true;
  for (int i = 0; primes[i] * primes[i] <= r; i++) {
    long long base = (l / primes[i]) * primes[i];
    if (base < l) {
      base = base + primes[i];
    }
    for (long long j = base; j <= r; j += primes[i]) {
      isprime[j - l] = false;
    }
    if (base == primes[i]) isprime[base - l] = true;
  }
  for (int i = 0; i < r - l + 1; i++) {
    if (isprime[i] == true) cout << i + l << '\n';
  }
}
long long isprime(long long N) {
  if (N < 2 || (!(N & 1) && N != 2)) return 0;
  for (long long i = 3; i * i <= N; i += 2) {
    if (!(N % i)) return 0;
  }
  return 1;
}
long long mulmod(long long a, long long b, long long mod) {
  long long res = 0;
  a = a % mod;
  while (b > 0) {
    if (b % 2 == 1) res = (res + a) % mod;
    a = (a * 2) % mod;
    b /= 2;
  }
  return res % mod;
}
long long power(long long x, long long y, long long m) {
  long long int res = 1;
  x = x % m;
  while (y > 0) {
    if (y & 1) res = mulmod(res, x, m);
    y = y >> 1;
    x = mulmod(x, x, m);
  }
  return res;
}
long long modinv(long long x, long long mod = 1000000007) {
  return power(x, mod - 2, mod);
}
long long B[100001];
long long C[100001];
long long D[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b, c, d;
  long long k, l, m, n, p, q, r, s, t, x, y;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  long long mx1 = 0, mx2 = 0;
  long long s1 = 0, s2 = 0;
  for (long long(i) = 0; (i) < (n); ++(i)) {
    cin >> A[i] >> B[i];
  }
  sort(A, A + n);
  sort(B, B + n);
  for (long long(i) = 0; (i) < (n); ++(i)) {
    mx1 += max(A[i], B[i]);
  }
  mx1 += n;
  cout << mx1 << '\n';
}
