#include <bits/stdc++.h>
using namespace std;
template <typename T>
T getint() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') p = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * p;
}
mt19937 gen(std::chrono::system_clock::now().time_since_epoch().count());
template <typename T1, typename T2>
bool umin(T1 &x, const T2 &y) {
  if (x > y) return x = y, true;
  return false;
}
template <typename T1, typename T2>
bool umax(T1 &x, const T2 &y) {
  if (x < y) return x = y, true;
  return false;
}
const int maxn = (int)1e6 + 10;
const int inf = (int)1e9 + 5;
const int mod = (int)1e9 + 7;
const long long llinf = (long long)1e18 + 5;
const long double pi = acos(-1.0);
int main() {
  int n;
  cin >> n;
  int res = 0;
  int cnt = 0;
  vector<int> was(n + 1);
  for (int(i) = (0); (i) < (n + n); ++(i)) {
    int x;
    cin >> x;
    if (was[x])
      cnt--;
    else
      cnt++;
    was[x] = 1;
    umax(res, cnt);
  }
  cout << res << endl;
  return 0;
}
