#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int temp[n + 1];
  int arr[2 * n];
  for (int i = 0; i < n + 1; i++) temp[i] = 0;
  for (int i = 0; i < 2 * n; i++) cin >> arr[i];
  int count = 0;
  int arrCount[2 * n];
  for (int i = 0; i < 2 * n; i++) arrCount[i] = 0;
  for (int i = 0; i < 2 * n; i++) {
    temp[arr[i]]++;
    if (temp[arr[i]] >= 2)
      count--;
    else {
      count++;
    }
    arrCount[i] = count;
  }
  int max = arrCount[0];
  for (int i = 0; i < 2 * n; i++)
    if (arrCount[i] > max) max = arrCount[i];
  cout << max << endl;
  return 0;
}
