#include <bits/stdc++.h>
const long long N = 1000000;
using namespace std;
long long n, k, l, i = 0, j, mn, mx = N, ans = 0, als, r1, r2, r3, t, q, v, m,
                   ii, r4;
string d1, d3, d2, s;
char kl, km, mk, lk;
double fg;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  bool a[N];
  for (i = 0; i < n * 2; i++) {
    cin >> t;
    a[t - 1] = !a[t - 1];
    m += a[t - 1] * 2 - 1;
    ans = max(ans, m);
  }
  cout << ans;
  return 0;
}
