#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 2e9 + 5;
int main() {
  cin.tie(0), cin.sync_with_stdio(0), cout.tie(0), cout.sync_with_stdio(0);
  int n;
  cin >> n;
  vi l(n), r(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  ll ans = n;
  for (int i = 0; i < n; i++) ans += max(l[i], r[i]);
  cout << ans;
  return cout << '\n', 0;
}
