#include <bits/stdc++.h>
using namespace std;
int a[1000001];
int main() {
  int n, x, m = 0, y = 0;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    a[x]++;
    if (a[x] == 1) {
      y++;
      if (y > m) m = y;
    } else
      y--;
  }
  cout << m;
  return 0;
}
