#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, y, p, i, j, m, s, t, r, q, c, r1, s1, ans;
  cin >> n;
  ans = p = 0;
  map<long long, long long> A;
  for (i = 1; i <= 2 * n; i++) {
    cin >> x;
    A[x] = (A[x] + 1) % 2;
    if (A[x] == 0) {
      ans = max(ans, p);
      p--;
    } else {
      p++;
    }
    ans = max(ans, p);
  }
  cout << max(ans, p) << endl;
}
