#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j, k, x, maxSz = 1, prev, cur;
  set<long long> st;
  cin >> n;
  n = 2 * n;
  while (n--) {
    cin >> x;
    prev = st.size();
    st.insert(x);
    cur = st.size();
    if (prev == cur) {
      st.erase(x);
      cur = st.size();
    }
    maxSz = max(maxSz, max(cur, prev));
  }
  cout << maxSz << endl;
  return 0;
}
