#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 1000010;
const int N = 1e5 + 10;
const int M = 210;
const int M1 = 1e9 + 7;
const int M2 = 1e9 + 9;
const int base = 131;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int l[n + 10], r[n + 10];
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
  }
  sort(l + 1, l + n + 1);
  sort(r + 1, r + n + 1);
  long long int ans = n;
  for (int i = 1; i <= n; i++) {
    ans = ans + max(l[i], r[i]);
  }
  cout << ans << endl;
}
