#include <bits/stdc++.h>
using namespace std;
int n;
long long ans;
int l[100000 + 3];
int r[100000 + 3];
int fa[2 * 100000 + 3];
int main() {
  scanf("%d", &n);
  ans = n;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &l[i], &r[i]);
    ans += l[i], ans += r[i];
  }
  sort(l + 1, l + n + 1);
  sort(r + 1, r + n + 1);
  for (int i = 1; i <= n; i++) ans -= min(l[i], r[i]);
  printf("%lld\n", ans);
  return 0;
}
