#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const double pi = 3.141593;
int main() {
  ios::sync_with_stdio(false);
  int n, t = 0, ans = 0;
  map<int, int> m;
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    int x;
    cin >> x;
    m[x]++;
    t++;
    if (m[x] == 2) t -= 2;
    ans = max(ans, t);
  }
  cout << ans;
}
