#include <bits/stdc++.h>
using namespace std;
uint64_t L[100000], R[100000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  size_t N;
  cin >> N;
  for (size_t i = 0; i < N; ++i) cin >> L[i] >> R[i];
  sort(L, L + N);
  sort(R, R + N);
  uint64_t ans = N;
  for (size_t i = 0; i < N; ++i) ans += max(L[i], R[i]);
  cout << ans << endl;
  return 0;
}
