#include <bits/stdc++.h>
inline int sbt(int x) { return __builtin_popcount(x); }
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int n;
  cin >> n;
  int vis[2 * n + 33];
  memset(vis, 0, sizeof vis);
  int res = 0, cnt = 0;
  for (int i = 1; i <= 2 * n; i++) {
    int x;
    cin >> x;
    vis[x]++;
    if (vis[x] == 1) {
      cnt++;
    } else if (vis[x] == 2) {
      vis[x] = 2;
      cnt--;
    }
    res = max(res, cnt);
  }
  res = max(res, cnt);
  cout << res;
  return 0;
}
