#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, a[1000000], num[1000000], total = 0;
int main() {
  scanf("%d", &n);
  for (i = 0; i < 2 * n; i++) {
    scanf("%d", &a[i]);
  }
  memset(num, 0, sizeof(num));
  int maxn = 0;
  for (i = 0; i < 2 * n; i++) {
    if (total > maxn) {
      maxn = total;
    }
    if (num[a[i]] == 1) {
      total--;
      num[a[i]] = 0;
    } else {
      num[a[i]] = 1;
      total++;
    }
  }
  printf("%d", maxn);
}
