#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, s[100001] = {0}, c, t = 0, m = 0;
  scanf("%d\n", &n);
  n *= 2;
  while (n--) {
    scanf("%d", &c);
    if (s[c]) {
      --t;
      --s[c];
    } else {
      ++t;
      ++s[c];
    }
    if (m < t)
      m = t;
  }
  printf("%d\n", m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x61a90(%rbp),%rdi
xor    %esi,%esi
mov    $0x61a84,%edx
call   1040 <memset@plt>
movl   $0x0,-0x61a98(%rbp)
movl   $0x0,-0x61a9c(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1234 <main+0x104>
lea    0xe67(%rip),%rdi
lea    -0x61a94(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x61a94(%rbp),%rax
cmpl   $0x0,-0x61a90(%rbp,%rax,4)
je     11ea <main+0xba>
mov    -0x61a98(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x61a98(%rbp)
movslq -0x61a94(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x61a90(%rbp,%rax,4)
jmp    1211 <main+0xe1>
mov    -0x61a98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a98(%rbp)
movslq -0x61a94(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x61a90(%rbp,%rax,4)
mov    -0x61a9c(%rbp),%eax
cmp    -0x61a98(%rbp),%eax
jge    122f <main+0xff>
mov    -0x61a98(%rbp),%eax
mov    %eax,-0x61a9c(%rbp)
jmp    1182 <main+0x52>
mov    -0x61a9c(%rbp),%esi
lea    0xdbf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x61aa0,%rsp
lea    0x10(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x61a84,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xea7(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
lea    (%rax,%rax,1),%ecx
add    $0xffffffff,%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
je     11c4 <main+0x94>
xor    %ebx,%ebx
lea    0xe86(%rip),%r14
lea    0xc(%rsp),%r15
mov    $0x1,%r12d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
mov    0x10(%rsp,%rax,4),%ecx
xor    %edx,%edx
sub    $0x1,%ecx
setb   %dl
cmovb  %r12d,%ecx
lea    -0x1(%rbp,%rdx,2),%ebp
cmp    %ebp,%ebx
cmovl  %ebp,%ebx
mov    %ecx,0x10(%rsp,%rax,4)
subl   $0x1,0x8(%rsp)
jae    1190 <main+0x60>
lea    0xe35(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100001 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [100001 x i32]* %3 to i8*
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, 2
store i32 %10, i32* %2
br label %11
11: ; preds = %44, %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %45
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100001 x i32], [100001 x i32]* %3, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %15
%23 = load i32, i32* %5
%24 = add nsw i32 %23, -1
store i32 %24, i32* %5
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100001 x i32], [100001 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = add nsw i32 %28, -1
store i32 %29, i32* %27
br label %38
30: ; preds = %15
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100001 x i32], [100001 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 1
store i32 %37, i32* %35
br label %38
38: ; preds = %30, %22
%39 = load i32, i32* %6
%40 = load i32, i32* %5
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = load i32, i32* %5
store i32 %43, i32* %6
br label %44
44: ; preds = %42, %38
br label %11
45: ; preds = %11
%46 = load i32, i32* %6
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100001 x i32]
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast [100001 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = shl nsw i32 %8, 1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %8, 0
br i1 %11, label %30, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %26, %12 ], [ 0, %0 ]
%14 = phi i32 [ %24, %12 ], [ 0, %0 ]
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100001 x i32], [100001 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 0
%21 = add nsw i32 %19, -1
%22 = select i1 %20, i32 1, i32 %21
%23 = select i1 %20, i32 1, i32 -1
%24 = add nsw i32 %23, %14
store i32 %22, i32* %18
%25 = icmp slt i32 %13, %24
%26 = select i1 %25, i32 %24, i32 %13
%27 = load i32, i32* %1
%28 = add nsw i32 %27, -1
store i32 %28, i32* %1
%29 = icmp eq i32 %27, 0
br i1 %29, label %30, label %12
30: ; preds = %12, %0
%31 = phi i32 [ 0, %0 ], [ %26, %12 ]
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
ret i32 0
}