#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bitset<100010> b;
  int mx = 0;
  n *= 2;
  int cnt = 0;
  while (n--) {
    int x;
    cin >> x;
    bool flag = (b[x] == 0);
    b.flip(x);
    if (flag)
      cnt++;
    else
      cnt--;
    if (cnt > mx) mx = cnt;
  }
  cout << mx << endl;
  return 0;
}
