#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, p = 0, c = 0, v[100005] = {0}, a;
  cin >> n;
  n = 2 * n;
  while (n--) {
    cin >> a;
    c++;
    v[a]++;
    if (v[a] == 2) {
      c--;
      if (c > p) p = c;
      c--;
    }
  }
  cout << p << endl;
  return 0;
}
