#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 922337203685477;
const long long mininf = -922337203685477;
const long long nax = 2e5 + 105;
long long n, a[nax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < 2 * n; i++) {
    cin >> a[i];
  }
  set<long long> st;
  long long ans = -inf;
  for (long long i = 0; i < 2 * n; i++) {
    if (!st.count(a[i])) {
      st.insert(a[i]);
    } else {
      auto idx = st.find(a[i]);
      st.erase(idx);
    }
    ans = max(ans, (long long)st.size());
  }
  cout << ans << '\n';
}
