#include <bits/stdc++.h>
int main() {
  int ara[100001], i, count = 0, max = 0, n, p;
  scanf("%d", &n);
  memset(ara, 0, sizeof(ara));
  for (i = 0; i < 2 * n; i++) {
    scanf("%d", &p);
    if (ara[p] > 0) {
      if (count > max) max = count;
      count--;
    } else {
      count++;
      ara[p]++;
    }
  }
  printf("%d", max);
  return 0;
}
