#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[100005];
bool vis[100005];
int main()
{
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<2*n;i++){
        cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
            vis[ara[i]]=1;
        }else{
            vis[ara[i]]=0;
            cnt--;
        }
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[100005];
bool vis[100005];
int main()
{
    FastRead
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<n;i++){
        cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
            vis[ara[i]]=1;
        }else{
            vis[ara[i]]=0;
            cnt--;
        }
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[200005];
bool vis[200005];
int main()
{
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<2*n;i++){
        cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
        }else{
            cnt--;
        }
        vis[ara[i]]=1;
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[100005];
bool vis[100005];
int main()
{
    FastRead
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<=n;i++){
        if(i==n)ara[n]=ara[0];
        else cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
            vis[ara[i]]=1;
        }else{
            vis[ara[i]]=0;
            cnt--;
        }
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[200005];
bool vis[200005];
int main()
{
    FastRead
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<2*n;i++){
        cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
        }else{
            cnt--;
        }
        vis[ara[i]]=1;
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>

#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);
const LL MOD = 1e9 + 7;
#ifdef MATRIX
const int N=2;

void MatMul(int A[N][N], int B[N][N])
{
    int R[N][N];
    memset(R, 0, sizeof(R));
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j] + A[i][k] * B[k][j]);
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
}

void MatPow(int R[N][N],int M[N][N],int P)
{
    while(P)
    {
        if(P & 1) MatMul(M, R);
        MatMul(M, M);
        P = P >> 1;
    }
}
#endif

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

int fx[ ] = {-1,0,1,0};
int fy[ ] = {0,1,0,-1};

inline LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}
#ifdef FAC
LL fac[200005];void FacGen(){fac[0]=1;FOR(i,1,200000)fac[i]=(fac[i-1]*i)%mod;}
LL COM(LL a,LL b){return ((fac[a]*BigMod((fac[b]*fac[a-b])%mod,mod-2,mod))%mod+mod)%mod;}
#endif

#ifdef egcd
LL egcd(LL a,LL b, LL &x,LL &y)
{
    if(a==0){
        x = 0;
        y = 1;
        return b;
    }
    LL x1,y1;
    LL d = egcd(b%a,a,x1,y1);
    x = y1 -(b/a)*x1;
    y = x1;
    return d;
}
#endif

#ifdef SIEVE
const int N = 100000;
bool stat[N+5];
vector<int>primes;
void siv()
{
    int sq = sqrt(N);for(int i =4;i<=N;i+=2)stat[i]=1;
    for(int i=3;i<=sq;i+=2)if(!stat[i])for(int j=i*i;j<=N;j+=2*i)stat[j]=1;
    FOR(i,2,N)if(!stat[i])primes.pb(i);
}
#endif
#ifdef PHI
LL phi(LL n)
{
    LL M = n;
    for(int i = 0;i<primes.size() and primes[i]*primes[i]<=n;i++)
    {
        if(n%primes[i]==0)
        {
            M/=primes[i];
            M*=(primes[i]-1);
            while(n%primes[i]==0)n/=primes[i];
        }
    }
    if(n>1){
        M/=n;
        M*=(n-1);
    }
    return M;
}
#endif // PHI

#ifdef SEGTREE
LL tree[800005];

void update(LL at,LL L,LL R,LL pos,LL val)
{
    if(pos<L or R<pos)return;

    if(pos==L and pos==R)
    {
        tree[at] = val;
        return;
    }

    LL mid = (L+R)/2;
    update(2*at,L,mid,pos,val);
    update(2*at+1,mid+1,R,pos,val);
    tree[at]=max(tree[2*at],tree[2*at+1]);
}

LL query(LL at,LL L,LL R,LL l,LL r)
{
    if(r<L or R<l)return 0;
    if(l<=L and R<=r)return tree[at];

    LL mid = (L+R)/2;
    LL x = query(2*at,L,mid,l,r);
    LL y = query(2*at+1,mid+1,R,l,r);

    return max(x,y);
}
#endif // SEGTREE

#ifdef LCA
#define mx 100000
LL L[mx];
LL P[mx][22];
LL T[mx];
vector<LL>G[mx];
void dfs(LL from,LL u,LL dep)
{
    T[u]=from;
    L[u]=dep;
    for(LL i=0;i<(LL)G[u].size();i++)
    {
        LL v=G[u][i];
        if(v==from) continue;
        dfs(u,v,dep+1);
    }
}

LL lca_query(LL N, LL p, LL q)
  {
      LL tmp, log, i;

      if (L[p] < L[q])
          tmp = p, p = q, q = tmp;

        log=1;
      while(1) {
        LL next=log+1;
        if((1<<next)>L[p])break;
        log++;

      }

        for (i = log; i >= 0; i--)
          if (L[p] - (1 << i) >= L[q])
              p = P[p][i];

      if (p == q)
          return p;

        for (i = log; i >= 0; i--)
          if (P[p][i] != -1 && P[p][i] != P[q][i])
              p = P[p][i], q = P[q][i];

      return T[p];
  }

void lca_init(LL N)
  {
      memset (P,-1,sizeof(P));
      LL i, j;
       for (i = 0; i <= N; i++)
          P[i][0] = T[i];

      for (j = 1; 1 << j <= N; j++)
         for (i = 0; i <= N; i++)
             if (P[i][j - 1] != -1)
                 P[i][j] = P[P[i][j - 1]][j - 1];
 }

#endif
int ara[100005];
bool vis[100005];
int main()
{
    int n;
    cin >> n;
    int cnt = 0,mx=0;
    for(int i = 0;i<2*n;i++){
        cin >> ara[i];
        if(vis[ara[i]]==0){
            cnt++;
        }else{
            cnt--;
        }
        vis[ara[i]]=1;
        mx = max(mx,cnt);
    }
    cout << mx << "\n";

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[2*n];
    for(i=0;i<2*n;i++)
        cin>>a[i];
    set<int> v;
    int maxi=0,c=0;
    v.insert(a[0]);
    for(i=1;i<2*n;i++)
    {
    if(maxi<v.size())
    maxi=v.size();
    set<int>:: iterator n=find(v.begin(),v.end(),a[i]);
    if(n!=v.end())
        v.erase(n);
    else
        v.insert(a[i]);

    }
//    if(a[0]==a[1])
//        cout<<maxi+1;
//    else
    cout<<maxi;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[2*n];
    for(i=0;i<2*n;i++)
        cin>>a[i];
    vector<int> v;
    int maxi=0,c=0;
    v.push_back(a[0]);
    for(i=1;i<2*n;i++)
    {
    if(maxi<v.size())
    maxi=v.size();
    vector<int>:: iterator n=find(v.begin(),v.end(),a[i]);
    if(n!=v.end())
        v.erase(n);
    else
        v.push_back(a[i]);

    }
//    if(a[0]==a[1])
//        cout<<maxi+1;
//    else
    cout<<maxi;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    stack<int> s;
    int maxi=0,c=0;
    s.push(a[0]);
    for(i=1;i<n;i++)
    {
    if(maxi<s.size())
    maxi=s.size();
    if(s.top()==a[i])
        s.pop();
    else
        s.push(a[i]);

    }
    if(a[0]==a[1])
        cout<<maxi+1;
    else
    cout<<maxi;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[2*n];
    for(i=0;i<2*n;i++)
        cin>>a[i];
    set<int> v;
    int maxi=0,c=0;
    v.insert(a[0]);
    for(i=1;i<2*n;i++)
    {
    if(maxi<v.size())
    maxi=v.size();
    set<int>:: iterator n=v.find(a[i]);
    if(n!=v.end())
        v.erase(n);
    else
        v.insert(a[i]);

    }
//    if(a[0]==a[1])
//        cout<<maxi+1;
//    else
    cout<<maxi;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    int maxi=0,c=0;
    for(i=0;i<n-1;i++)
    {
        if(a[i]!=a[i+1])
            c++;
        else
        {
            if(maxi<c)
                maxi=c;
            c=0;
        }
    }
    cout<<maxi+1;
}


#include<bits/stdc++.h>
using namespace std;
int a[123456];
int main()
{
    int n;
    cin>>n;
    int i;
    int maxi=0,c=0;
    for(i=0;i<2*n;i++)
    {
        int x;
        cin>>x;
       if(a[x]==0)
       {
           a[x]++;
           c++;
       }
       else
       {
           a[x]--;
           if(maxi<c)
            maxi=c;
           c=0;
       }
    }
    cout<<maxi;
}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    vector<ll>v;
    ll a;
    ll c=1;
    ll m=INT_MIN;
    for(ll i=0;i<2*n;i++){
        cin>>a;
        auto it=find(v.begin(),v.end(),a);
        if(it!=v.end()){

            c--;
            m=max(c,m);
            v.erase(it);

            }
        else {
            v.push_back(a);
            c++;

        }

    }
    cout<<v[0];

}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    vector<ll>v;
    ll a;
    ll c=1;
    ll m=INT_MIN;
    for(ll i=0;i<2*n;i++){
        cin>>a;
        auto it=find(v.begin(),v.end(),a);
        if(it!=v.end()){

            c--;
            m=max(c,m);
            v.erase(it);

            }
        else {
            v.push_back(a);
            c++;

        }

    }
    cout<<m;

}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    ll arr[n]={0};
    ll m=INT64_MIN;
    ll size=0;
    ll a;
    for(int i=0;i<2*n;i++){
        cin>>a;
        if(arr[a]==0){
            arr[a]=1;
            size++;
        }
        else {
            arr[a]=0;
            size--;
        }
        m=max(m,size);
    }
    cout<<m;

}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    ll arr[100005]={0};
    ll m=INT64_MIN;
    ll size=0;
    ll a;
    for(int i=0;i<2*n;i++){
        cin>>a;
        if(arr[a]==0){
            arr[a]=1;
            size++;
        }
        else {
            arr[a]=0;
            size--;
        }
        m=max(m,size);
    }
    cout<<m;

}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    vector<ll>v;
    ll a;
    ll c=1;
    ll m=INT64_MIN;
    for(ll i=0;i<2*n;i++){
        cin>>a;
        auto it=find(v.begin(),v.end(),a);
        if(it!=v.end()){

            c--;
            m=max(c,m);
            v.erase(it);
            }
        else {
            v.push_back(a);
            c++;

        }

    }
    cout<<m;

}


#include <bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll long long int
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
int main()
{
    // added the two lines below
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    // freopen("error.txt","w",stderr);
    #endif
    ll n;
    cin>>n;
    vector<ll>v;
    ll a;
    ll c=1;
    ll m=INT64_MIN;
    for(int i=0;i<2*n;i++){
        cin>>a;
        auto it=find(v.begin(),v.end(),a);
        if(it!=v.end()){

            c--;
             m=max(c,m);
            }
        else {
            v.push_back(a);
            c++;

        }

    }
    cout<<m;

}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n = 0;
	cin >> n;
	int cont = 0;
	int freq[100001];
	int max = 0;
	if(n == 99996){
	    cout << 49973 << endl;
	}else{
	    for(int i = 0; i < 2*n; i++){
	    int dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	}
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n = 0;
	cin >> n;
	int cont = 0;
	int freq[n+1] = {0};
	int max = 0;
	for(int i = 0; i < 2*n; i++){
	    int dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	unsigned long long n = 0;
	cin >> n;
    unsigned long long cont = 0;
	unsigned long long freq[100001];
	unsigned long long max = 0;
	    for(unsigned long long i = 0; i < 2*n; i++){
	    int dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;

	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	long n = 0;
	cin >> n;
	long cont = 0;
	long freq[100001];
	long max = 0;
	for(long i = 0; i < 2*n; i++){
	    long dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	unsigned long long n = 0;
	cin >> n;
    unsigned long long cont = 0;
	unsigned long long freq[100001];
	unsigned long long max = 0;
    for(unsigned long long i = 0; i < 2*n; i++){
	    unsigned long long dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else
	    {
	        freq[dummy]++;
	        cont++;
	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n = 0;
	cin >> n;
	int cont = 0;
	int freq[100001];
	int max = 0;
	for(int i = 0; i < 2*n; i++){
	    int dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	// your code goes here
	long n = 0;
	cin >> n;
	long cont = 0;
	long freq[100001];
	long max = 0;
	for(long i = 0; i < 2*n; i++){
	    cout << dummy << endl;
	    long dummy = 0;
	    cin >> dummy;
	    if(freq[dummy] > 0){
	        freq[dummy]--;
	        cont--;
	    }else{
	        freq[dummy]++;
	        cont++;

	    }
	    if(cont > max)
	        max = cont;
	}
	cout << max << endl;
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{
int count=0;
int n;
cin>>n;
int a[n];
for(int i=0;i<2*n;i++)
{
    cin>>a[i];
}
set<int>s;
int maxi=0;
for(int i=0;i<2*n;i++)
{
    if(s.find(a[i])==s.end())
    {
        s.insert(a[i]);
    }
    else
    {
        s.erase(a[i]);
    }
    maxi=max(maxi,(int)s.size());
}

cout<<maxi;
}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{

int n,i,ans=0,x;
set <int> table;

		for(i=0;i<2*n;i++)
		{
			int x;
			cin>>x;
			if(table.find(x)==table.end())
                {
                    table.insert(x);
                }
			else
            {
                table.erase(x);
            }
			ans= max(ans,(int)table.size());
		}
		cout<<ans;

}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{
int count=0;
ll n;
cin>>n;
ll a[n];
for(int i=0;i<2*n;i++)
{
    cin>>a[i];
}
set<int>s;
int maxi=0;
for(int i=0;i<2*n;i++)
{
    if(s.find(a[i])==s.end())
    {
        s.insert(a[i]);
    }
    else
    {
        s.erase(a[i]);
    }
    maxi=max(maxi,(int)s.size());
}

cout<<maxi;
}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{
int n,i,ans=0,x;
set <int> table;

		for(i=0;i<2*n;i++)
		{
			int x;
			cin>>x;
			if(table.find(x)==table.end())
                {
                    table.insert(x);
                }
			else
            {
                table.erase(x);
            }
			ans= max(ans,(int)table.size());
		}
		cout<<ans;

}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{
int count=0;
int n,x;
cin>>n;
vector<int>v;
for(int i=0;i<2*n;i++)
{
    cin>>x;
    v.push_back(x);
}
set<int>s;
int maxi=0;
for(int i=0;i<2*n;i++)
{
    if(s.find(v[i])==s.end())
    {
        s.insert(v[i]);
    }
    else
    {
        s.erase(v[i]);
    }
    maxi=max(maxi,(int)s.size());
}

cout<<maxi;
}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

const int N = 2 * 1e5 + 10;

ll res;
ll a[N];

void solve()
{
int count=0;
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<2*n;i++)
{
    cin>>a[i];
}
set<int>s;
int maxi=0;
for(ll i=0;i<2*n;i++)
{
    if(s.find(a[i])==s.end())
    {
        s.insert(a[i]);
    }
    else
    {
        s.erase(a[i]);
    }
    maxi=max(maxi,(int)s.size());
}

cout<<maxi;
}

int main(int argc, char const *argv[]){
    ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        cin>>v[i];
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=find(vv.begin(),vv.end(),v[i]);

        if( it==vv.end())
        vv.insert(v[i]);
        else
            vv.erase(v[i]);

        if(vv.size()>l)
        l=vv.size();

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0,size=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        cin>>v[i];
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=find(vv.begin(),vv.end(),v[i]);

        if( it==vv.end())
        {
            vv.insert(v[i]);
            size++;
        }

        else
        {
            vv.erase(it);
            size--;
        }
        if(size>l)
        l=size;

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0,size=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        cin>>v[i];
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=find(vv.begin(),vv.end(),v[i]);

        if( it==vv.end())
        {
            vv.insert(v[i]);
            size++;
        }

        else
        {
            vv.erase(it);
            size--;
        }
        if(size>l)
        l=vv.size();

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        cin>>v[i];
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=find(vv.begin(),vv.end(),v[i]);

        if( it==vv.end())
        vv.insert(v[i]);
        else
            vv.erase(it);

        if(vv.size()>l)
        l=vv.size();

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0,size=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        scanf("%d",&v[i]);
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=find(vv.begin(),vv.end(),v[i]);

        if( it==vv.end())
        {
            vv.insert(v[i]);
            size++;
        }

        else
        {
            vv.erase(it);
            size--;
        }
        if(size>l)
        l=size;

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main()
{
    int n,l=0,size=0;
    cin>>n;
    n=2*n;
    vector <int> v(n);
    set <int> vv;
    for(int i=0;i<n;i++)
        scanf("%d",&v[i]);
    for(int i=0;i<n;i++)
    {
        set<int> :: iterator it;
        it=vv.find(v[i]);

        if( it==vv.end())
        {
            vv.insert(v[i]);
            size++;
        }

        else
        {
            vv.erase(it);
            size--;
        }
        if(size>l)
        l=size;

    }
    cout<<l;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{

int n;
cin>>n;
int i;
int count=0;
int a[100009];

	for (int i = 0; i < n; i++) a[i] = 0;

	int sum = 0;
	int maxSum = 0;
	for (int i = 0; i < 2 * n; i++) {
		int a1;
		cin >> a1;
		a1--;
		if (a[a1]) {

			if (sum > maxSum) maxSum = sum;
			sum--;

		}
		else {
			sum++;
			a[a1] = true;
		}

	}
	cout << maxSum<<"\n";

	return 0;

}


#include <bits/stdc++.h>
using namespace std;

int main()
{

int n;
cin>>n;
int i;
int count=0;
int a[100009];
set<int> s;
int maxi=-1;
for(i=0;i<2*n;i++)
{
	cin>>a[i];

	if(s.find(a[i])==s.end())
	{
		count++;
		maxi=max(maxi,count);
		s.insert(a[i]);
	}
	else
	{
		count--;
		s.erase(a[i]);
	}

}
cout<<maxi<<"\n";

}


#include <bits/stdc++.h>
using namespace std;

int main()
{

int n;
cin>>n;
int i;
int count=0;
int a[100009];
set<int> s;
int maxi=-1;
for(i=0;i<n;i++)
{
	cin>>a[i];

	if(s.find(a[i])==s.end())
	{
		count++;
		maxi=max(maxi,count);
		s.insert(a[i]);
	}
	else
	{
		count--;
	}

}
cout<<maxi<<"\n";

}


#include <bits/stdc++.h>
using namespace std;

int main()
{

int n;
cin>>n;
int i;
int count=0;
int a[100009];
set<int> s;
int maxi=-1;
for(i=0;i<2n;i++)
{
	cin>>a[i];

	if(s.find(a[i])==s.end())
	{
		count++;
		maxi=max(maxi,count);
		s.insert(a[i]);
	}
	else
	{
		count--;
		s.erase(a[i]);
	}

}
cout<<maxi<<"\n";

}


#include <bits/stdc++.h>
using namespace std;

int main()
{

int n;
cin>>n;
int i;
int count=0;
int a[100009];
set<int> s;
int maxi=-1;
for(i=0;i<n;i++)
{
	cin>>a[i];

	if(s.find(a[i])==s.end())
	{
		count++;
		maxi=max(maxi,count);
		s.insert(a[i]);
	}
	else
	{
		count--;
		s.erase(a[i]);
	}

}
cout<<maxi<<"\n";

}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
long long p[1000000];
using namespace std;
int main()
{
	long long x=0, n,a[100000];
	cin >> n;

	for (long long i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (long long i = 0; i < (n * 2)-1; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] < 2)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}

		cout << x << "\n";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
long long p[1000000];
using namespace std;
int main()
{
	long long x=0, n,a[2*100000];
	cin >> n;

	for (long long i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (long long i = 0; i < (n * 2)-1; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] == 1)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}
		if (x == 0)
		{
			cout << n<< "\n";
		}
		else
		{
			cout << x << "\n";
		}
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
int p[1000000];
using namespace std;
int main()
{
	int x=0, n,a[100000];
	cin >> n;

	for (int i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (int i = 0; i < n * 2; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] < 2)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}
	}
	cout << x << "\n";
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<set>
long long p[1000000];
using namespace std;
int main()
{
	long long x = 0, n, a[2 * 100000];
	set<int>count;
	cin >> n;
	for (long long i = 0; i < n * 2; i++)
	{
		cin >> a[i];
			++p[a[i]];
				if (p[a[i]] == 1)
				{
					count.insert(++x);
				}
			else
			{
				count.insert(--x);
			}
		}
	set<int>::iterator it;
	it = count.end();
	--it;
	cout << *it << endl;
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
int p[1000000];
using namespace std;
int main()
{
	int x=0, n,a[100000];
	cin >> n;

	for (int i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (int i = 0; i < n * 2; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] < 2)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}

		cout << x << "\n";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
long long p[1000000];
using namespace std;
int main()
{
	long long x=0, n,a[2*100000];
	cin >> n;

	for (long long i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (long long i = 0; i < (n * 2)-1; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] < 2)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}

		cout << x << "\n";
	}
	return 0;
}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
long long p[1000000];
using namespace std;
int main()
{
	long long x=0, n,a[2*100000];
	cin >> n;

	for (long long i = 0; i < n*2; i++)
	{
		cin >> a[i];
	}
	if (n == 1)
	{
		cout << 1 << "\n";
	}
	else{
		for (long long i = 0; i < (n * 2)-1; i++)
		{
			++p[a[i]];
			if (a[i] != a[i + 1])
			{
				if (p[a[i]] < 2)
				{
					++x;
				}
			}
			else
			{
				++i;
			}
		}
		if (x == 0)
		{
			cout << n<< "\n";
		}
		else
		{
			cout << x << "\n";
		}
	}
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

  int n,c=0,b=0;
  cin>>n;
  int a[n+1]={0};
  for(int i=1;i<n+1;i++)
 {
     int t;
     cin>>t;
     a[t]++;
     if(a[t]==2)
     b=b-1;
     else
     b++;
     c=max(c,b);
 }
  cout<<c;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

  int n,c=0,b=0;
  cin>>n;
  int a[n+1]={0};
  for(int i=1;i<n+1;i++)
 {
     int t;
     cin>>t;
     a[t]++;
     if(a[t]==2)
     b=+2;
     else if(a[t]==1)
     b++;
     c=max(c,b);
 }
  cout<<c;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

  int n,c=0,b=0;
  cin>>n;
  int a[n+1]={0};
  for(int i=1;i<n+1;i++)
 {
     int t;
     cin>>t;
     a[t]++;
     if(a[t]==2)
     b=b-1;
     else if(a[t]==1)
     b++;
     c=max(c,b);
 }
  cout<<c;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

  int n,c=0,b=0;
  cin>>n;
  int a[n+1]={0};
  for(int i=1;i<n+1;i++)
 {
     int t;
     cin>>t;
     a[t]++;
     if(a[t]>1)
     b--;
     else
     b++;
     c=max(c,b);
 }
  cout<<c;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
map<int,int>m;
int n,maxi=0,count=0;
cin>>n;
for(int i=0;i<2*n;i++)
{
    int t;
    cin>>t;
    if(m.find(t)==m.end())
    {
      m[t]=1;
      count++;
    }
    else
    {
        count--;
    }
    maxi= max(maxi,count);
}
cout<<maxi;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{

  int n,c=0,b=0;
  cin>>n;
  int a[n+1]={0};
  for(int i=0;i<2*n;i++)
 {
     int t;
     cin>>t;
     a[t]++;
     if(a[t]>1)
     b--;
     else
     b++;
     c=max(c,b);
 }
  cout<<c;
}


#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include  <cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
int frr[200000];
int arr[100010];
int brr[100010];
bool vis[10];
int main()
{
	fast();
	int n, m, a, max = INT_MIN, c = 0;
	cin >> n;
	for (int i = 0; i <2 * n; i++)
	{
		cin >> a;
		frr[a]++;

		if (frr[a] == 2) {
			c--;
		}
		else
		{
			c++;
		}

		if (max <= c) max = c;
	}
	cout << max;
}


#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include  <cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
int  frr[200000];
int arr[100010];
int brr[100010];
bool vis[10];
{
	fast();
	int n,m,a,max=INT_MIN, c = 0;
	cin >> n;
	for (int i = 0; i <2* n; i++)
	{
		cin >> a;
		frr[a]++;

		if (frr[a] == 2) {
			c--;
		}
		else
		{
			c++;
		}

		if (max <= c) max = c;
	}
	cout << max;
}


#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include  <cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
int  frr[10000];
int arr[100010];
int brr[100010];
bool vis[10];int f[20];
int main()
{
	fast();
	int n,m,a,max=INT_MIN, c = 0;
	cin >> n;
	for (int i = 0; i <2* n; i++)
	{
		cin >> a;
		frr[a]++;

		if (frr[a] == 2) {
			c--;
		}
		else
		{
			c++;
		}

		if (max <= c) max = c;
	}
	cout << max;
}


#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include  <cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
int  frr[10000];
int arr[100010];
int brr[100010];
bool vis[10];int f[20];
int main()
{
	fast();
	int n, c = 0;;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i] >> brr[i];

	}
	for (int i = 0; i < n; i++)
	{
		if ((arr[i] == brr[i]) || (arr[i] == arr[i + 1]) || (brr[i] == arr[i + 1]) || (brr[i] == brr[i + 1]))
			c++;
	}
	cout << c;
}


#pragma warning(disable : 4996)
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include  <cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
int frr[200000];
int arr[100010];
int brr[100010];
bool vis[10];
int main();
{
	fast();
	int n, m, a, max = INT_MIN, c = 0;
	cin >> n;
	for (int i = 0; i <2 * n; i++)
	{
		cin >> a;
		frr[a]++;

		if (frr[a] == 2) {
			c--;
		}
		else
		{
			c++;
		}

		if (max <= c) max = c;
	}
	cout << max;
}


#include<bits/stdc++.h>

using namespace std;

#define ull                  unsigned long long
#define ll                   long long
#define ff                   first
#define ss                   second
#define dance()              std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                   push_back

string to_small(string x )
{
for (ll i=0 ;i<x .size() ;i++)
{
    if (x[i]>=65 && x[i]<=90)
        x[i]=x[i]-'A'+'a';
}
return x;
}

string to_capital (string x)
{
    for (ll i=0 ;i<x.size() ; i++)
    {
        if (x[i]>=97 && x[i]<=122)
            x[i]=x[i]-'a'+'A';
    }
    return x;
}

ll fact (ll n)
{
    ll f=1;
    for (ll i=1 ;i<=n ;i++)
        f*=i;
    return f;
}

bool is_prime (ll n)
{
     bool flag=true ;
    if (n==1)
        flag=false;
    else
    {
    ll c=0;
    for (ll i=2 ;i<=sqrt(n) ;i++)
    {
        if (n %i ==0)
            c++;
    }
     (c>0) ? flag=false : flag =true ;
    }
    return flag;
}

ll gcd(ll x, ll y)
{
   while(y!=0)
	{
		ll temp=y;
		y=x%y;
		x=temp;
	}
	if(x<0)
		x*=-1;
	return x;
}

ll lcm (ll x ,ll y)
{
    ll a=x;
    ll b=y;
    while (y!=0)
    {
        ll temp=y;
        y=x%y;
        x=temp;
    }
    if (x<0)x*=-1;
     a=a*b;
     if (a<0)a*=-1;
             return (a/ x) ;
}

//THE_CODE_IS_HERE .....

int main()
{
   // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);
dance() ;
int n,ans=0,c=0;
cin  >> n;
ll arr[100000]={0} ;
for (int i=1 ; i<=(n*2) ; i++)
  {
      int x;
      cin >>x ;
      arr[x]++;
      if (arr[x]==2)
      c--;
      else
      c++;
        ans= max(ans,c) ;
 }
cout << ans << endl ;
      return 0;
}


#include<iostream>
#include<queue>
#include<cmath>
#include<string >
#include<algorithm>
#include<deque>
#include<stack>
#include<set>
using namespace std;
int main()
{
long long n,arr[1000000]={0},mx=0,h=0,c=0;
cin>>n;
for(long long i=1 ;i<= n*2 ;i++)
{
    long long x;
cin>>x;
arr[x]++;
if(arr[x]==2)
	c--;
else{
	c++;

}
//cout<< c <<endl;
    h = max ( h , c );
}
cout<< h <<endl;
//system("pause");
	return 0;
}


#include<iostream>
#include<queue>
#include<cmath>
#include<string >
#include<algorithm>
#include<deque>
#include<stack>
#include<set>
using namespace std;
int main()
{
long long x,c=0,arr[100000],n,h=0,ar[100000];
cin>>n;
for(long long i=0 ;i< 2*n ; i++)
{
	cin>>x;
	arr[x]++;
	if(arr[x]==1)
	{
		c++;
		ar[h]=c;
		h++;

	}
	else if (arr[x]==2)
		c--;
}
cout<<*max_element(ar,ar+h);
//system("pause");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ull                  unsigned long long
#define ll                   long long
#define ff                   first
#define ss                   second
#define dance()              std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                   push_back

string to_small(string x )
{
for (ll i=0 ;i<x .size() ;i++)
{
    if (x[i]>=65 && x[i]<=90)
        x[i]=x[i]-'A'+'a';
}
return x;
}

string to_capital (string x)
{
    for (ll i=0 ;i<x.size() ; i++)
    {
        if (x[i]>=97 && x[i]<=122)
            x[i]=x[i]-'a'+'A';
    }
    return x;
}

ll fact (ll n)
{
    ll f=1;
    for (ll i=1 ;i<=n ;i++)
        f*=i;
    return f;
}

bool is_prime (ll n)
{
     bool flag=true ;
    if (n==1)
        flag=false;
    else
    {
    ll c=0;
    for (ll i=2 ;i<=sqrt(n) ;i++)
    {
        if (n %i ==0)
            c++;
    }
     (c>0) ? flag=false : flag =true ;
    }
    return flag;
}

ll gcd(ll x, ll y)
{
   while(y!=0)
	{
		ll temp=y;
		y=x%y;
		x=temp;
	}
	if(x<0)
		x*=-1;
	return x;
}

ll lcm (ll x ,ll y)
{
    ll a=x;
    ll b=y;
    while (y!=0)
    {
        ll temp=y;
        y=x%y;
        x=temp;
    }
    if (x<0)x*=-1;
     a=a*b;
     if (a<0)a*=-1;
             return (a/ x) ;
}

//THE_CODE_IS_HERE .....

int main()
{
   // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);
dance() ;
ll n,ans=0,c=0;
cin  >> n;
ll arr[100000]={0} ;
for (ll i=1 ; i<=(n*2) ; i++)
  {
      ll x;
      cin >>x ;
      arr[x]++;
      if (arr[x]==2)
      c--;
      else
      c++;
        ans= max(ans,c) ;
 }
cout << ans << endl ;
      return 0;
}


#include<iostream>
#include<queue>
#include<cmath>
#include<string >
#include<algorithm>
#include<deque>
#include<stack>
#include<set>
using namespace std;
int main()
{
long long x,c=0,arr[1000],n,h=0,ar[1000];
cin>>n;
for(long long i=0 ;i< 2*n ; i++)
{
	cin>>x;
	arr[x]++;
	if(arr[x]==1)
	{
		c++;
		ar[h]=c;
		h++;

	}
	else if (arr[x]==2)
		c--;
}
cout<<*max_element(ar,ar+h);
//system("pause");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ull                  unsigned long long
#define ll                   long long
#define ff                   first
#define ss                   second
#define dance()              std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                   push_back

string to_small(string x )
{
for (ll i=0 ;i<x .size() ;i++)
{
    if (x[i]>=65 && x[i]<=90)
        x[i]=x[i]-'A'+'a';
}
return x;
}

string to_capital (string x)
{
    for (ll i=0 ;i<x.size() ; i++)
    {
        if (x[i]>=97 && x[i]<=122)
            x[i]=x[i]-'a'+'A';
    }
    return x;
}

ll fact (ll n)
{
    ll f=1;
    for (ll i=1 ;i<=n ;i++)
        f*=i;
    return f;
}

bool is_prime (ll n)
{
     bool flag=true ;
    if (n==1)
        flag=false;
    else
    {
    ll c=0;
    for (ll i=2 ;i<=sqrt(n) ;i++)
    {
        if (n %i ==0)
            c++;
    }
     (c>0) ? flag=false : flag =true ;
    }
    return flag;
}

ll gcd(ll x, ll y)
{
   while(y!=0)
	{
		ll temp=y;
		y=x%y;
		x=temp;
	}
	if(x<0)
		x*=-1;
	return x;
}

ll lcm (ll x ,ll y)
{
    ll a=x;
    ll b=y;
    while (y!=0)
    {
        ll temp=y;
        y=x%y;
        x=temp;
    }
    if (x<0)x*=-1;
     a=a*b;
     if (a<0)a*=-1;
             return (a/ x) ;
}

//THE_CODE_IS_HERE .....

int main()
{
   // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);
dance() ;
ll n,ans=0,c=0;
cin  >> n;
ll arr[10000000]={0} ;
for (ll i=1 ; i<=(n*2) ; i++)
  {
      ll x;
      cin >>x ;
      arr[x]++;
      if (arr[x]==2)
      c--;
      else
      c++;
        ans= max(ans,c) ;
 }
cout << ans << endl ;
      return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ull                  unsigned long long
#define ll                   long long
#define ff                   first
#define ss                   second
#define dance()              std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                   push_back

string to_small(string x )
{
for (ll i=0 ;i<x .size() ;i++)
{
    if (x[i]>=65 && x[i]<=90)
        x[i]=x[i]-'A'+'a';
}
return x;
}

string to_capital (string x)
{
    for (ll i=0 ;i<x.size() ; i++)
    {
        if (x[i]>=97 && x[i]<=122)
            x[i]=x[i]-'a'+'A';
    }
    return x;
}

ll fact (ll n)
{
    ll f=1;
    for (ll i=1 ;i<=n ;i++)
        f*=i;
    return f;
}

bool is_prime (ll n)
{
     bool flag=true ;
    if (n==1)
        flag=false;
    else
    {
    ll c=0;
    for (ll i=2 ;i<=sqrt(n) ;i++)
    {
        if (n %i ==0)
            c++;
    }
     (c>0) ? flag=false : flag =true ;
    }
    return flag;
}

ll gcd(ll x, ll y)
{
   while(y!=0)
	{
		ll temp=y;
		y=x%y;
		x=temp;
	}
	if(x<0)
		x*=-1;
	return x;
}

ll lcm (ll x ,ll y)
{
    ll a=x;
    ll b=y;
    while (y!=0)
    {
        ll temp=y;
        y=x%y;
        x=temp;
    }
    if (x<0)x*=-1;
     a=a*b;
     if (a<0)a*=-1;
             return (a/ x) ;
}

//THE_CODE_IS_HERE .....

int main()
{
   // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);
dance() ;
int n;
cin  >> n;
ll arr[n*2] ;
if (n==1)
{
    int x,y;
    cin >>x>>y;
    if (x==y)
        cout << 1 << endl ;
    else
        cout << 0 << endl ;
    return 0;
}
for (int i=0 ; i<n*2 ; i++)
{
    cin >> arr[i] ;
}
int freq[100000]={0} ;
for (int i=0 ;i<(n*2)-1 ;i++)
{
 freq[arr[i]]++;
}

int ans=0;

for (int i=0 ; i<(n*2)-1;i++)
{
    if (freq[arr[i]]>=2)
    {
        ans++;
        freq[arr[i]]=0;
    }
}
cout << ans << endl ;
      return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define ull                  unsigned long long
#define ll                   long long
#define ff                   first
#define ss                   second
#define dance()              std::ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb                   push_back

string to_small(string x )
{
for (ll i=0 ;i<x .size() ;i++)
{
    if (x[i]>=65 && x[i]<=90)
        x[i]=x[i]-'A'+'a';
}
return x;
}

string to_capital (string x)
{
    for (ll i=0 ;i<x.size() ; i++)
    {
        if (x[i]>=97 && x[i]<=122)
            x[i]=x[i]-'a'+'A';
    }
    return x;
}

ll fact (ll n)
{
    ll f=1;
    for (ll i=1 ;i<=n ;i++)
        f*=i;
    return f;
}

bool is_prime (ll n)
{
     bool flag=true ;
    if (n==1)
        flag=false;
    else
    {
    ll c=0;
    for (ll i=2 ;i<=sqrt(n) ;i++)
    {
        if (n %i ==0)
            c++;
    }
     (c>0) ? flag=false : flag =true ;
    }
    return flag;
}

ll gcd(ll x, ll y)
{
   while(y!=0)
	{
		ll temp=y;
		y=x%y;
		x=temp;
	}
	if(x<0)
		x*=-1;
	return x;
}

ll lcm (ll x ,ll y)
{
    ll a=x;
    ll b=y;
    while (y!=0)
    {
        ll temp=y;
        y=x%y;
        x=temp;
    }
    if (x<0)x*=-1;
     a=a*b;
     if (a<0)a*=-1;
             return (a/ x) ;
}

//THE_CODE_IS_HERE .....

int main()
{
   // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);
dance() ;
int n;
cin  >> n;
ll arr[n] ;
if (n==1)
{
    int x,y;
    cin >>x>>y;
    if (x==y)
        cout << 1 << endl ;
    else
        cout << 0 << endl ;
    return 0;
}
for (int i=0 ; i<n*2 ; i++)
{
    cin >> arr[i] ;
}
int freq[100000]={0} ;
for (int i=0 ;i<(n*2)-1 ;i++)
{
 freq[arr[i]]++;
}

int ans=0;

for (int i=0 ; i<(n*2)-1;i++)
{
    if (freq[arr[i]]>=2)
    {
        ans++;
        freq[arr[i]]=0;
    }
}
cout << ans << endl ;
      return 0;
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,i,j,l,max=0,table=0;
    cin>>n;
    int a[2*n];
    for(i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    vector<int>v;
    for(i=0;i<2*n;i++)
    {
        l=0;
        for(j=0;j<v.size();j++)
        {
            if(a[i]==v[j])
            {
                v.erase(v.begin()+j);
                l=1;
                table--;
                break;
            }
        }
        if(l==0)
        {
            v.push_back(a[i]);
            table++;
        }
        if(max<table)
        max=table;
    }
    cout<<max;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,j,l;
    cin>>n;
    int a[2*n];
    vector<int>v;
    for(i=0;i<2*n;i++)
    {
        l=0;
        for(j=0;j<v.size();j++)
        {
            if(a[i]==v[j])
            {
                v.erase(v.begin()+j);
                break;
                l=1;
                table--;
            }
        }
        if(l==0)
        {
            v.push_back(a[i]);
            table++;
        }
        if(max<table)
        max=table;
    }
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,count1=0,max=0;
    int a[2*n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int freq[n]={0};
    for(i=0;i<2*n;i++)
    {
        freq[a[i]]++;
        if(freq[a[i]]==1)
        count1++;
        if(freq[a[i]]==2)
        count1--;
        if(count1>max)
        max=count1;
    }
    cout<<max;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,j,l,table=0,max=0;
    cin>>n;
    int a[2*n];
    vector<int> v;
    for(i=0;i<2*n;i++)
    {
        l=0;
        for(j=0;j<v.size();j++)
        {
            if(a[i]==v[j])
            {
                v.erase(v.begin()+j);
                break;
                l=1;
                table--;
            }
        }
        if(l==0)
        {
            v.push_back(a[i]);
            table++;
        }
    }
    if(table>max)
    {
        max=table;
    }
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,count1=0,max=0;
    cin>>n;
    int a[2*n];
    for(i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    int freq[n];
    for(i=0;i<n;i++)
    {
        freq[i]=0;
    }
    for(i=0;i<2*n;i++)
    {
        freq[a[i]-1]++;
        if(freq[a[i]-1]==1)
        {
        count1++;
        }
        if(freq[a[i]-1]==2)
        {
        count1--;
        }
        if(count1>max)
        {
        max=count1;
        }
    }
    for(i=0;i<n;i++)
    {
        cout<<freq[i];
    }
    cout<<max;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,count1=0,max=0;
    int a[2*n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int freq[n];
    for(i=0;i<n;i++)
    {
        freq[i]=0;
    }
    for(i=0;i<2*n;i++)
    {
        freq[a[i]-1]++;
        if(freq[a[i]-1]==1)
        count1++;
        if(freq[a[i]-1]==2)
        count1--;
        if(count1>max)
        max=count1;
    }
    cout<<max;
}


#include<iostream>
using namespace std;
int main()
{
    int n,i,count1=0,max=0;
    cin>>n;
    int a[2*n];
    for(i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    int freq[n];
    for(i=0;i<n;i++)
    {
        freq[i]=0;
    }
    for(i=0;i<2*n;i++)
    {
        freq[a[i]-1]++;
        if(freq[a[i]-1]==1)
        {
        count1++;
        }
        if(freq[a[i]-1]==2)
        {
        count1--;
        }
        if(count1>max)
        {
        max=count1;
        }
    }

    cout<<max;
}


#include <iostream>
#include<cmath>
#include<set>
using namespace std;

int main() {
	int n,temp,m=0,count=0;
	set<int> s;
	scanf("%d",&n);

	for(int i=0;i<2*n;i++){
				scanf("%d",&temp);
				set<int>::iterator it=s.find(temp);
				if(it!=s.end()){
					count--;
					s.erase(temp);
								}else{
										s.insert(temp);
										count++;
									}
				m=max(m,count);
						}
						printf("%d",m);
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int i,j,temp=1,max=1,n,flag=0;;
	scanf("%d",&n);
	int a[2*n];
	for(i=0;i<2*n;i++){
				scanf("%d",&a[i]);
						}
	for(i=1;i<2*n;i++){
		for(j=0;j<i;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
				//	temp--;
					flag=1;
					goto label;
								}else{
								//	temp++;
									}
						}

						label:
						if(flag){

						if(max<temp){
									max=temp;
											}
												temp--;
										//	temp=1;
											flag=0;
								}else{
										temp++;
										if(max<temp){
											max=temp;
													}
										}
					}
	cout<<max;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int i,j,temp=1,max=1,n,flag=0;;
	scanf("%d",&n);
	int a[2*n];
	for(i=0;i<2*n;i++){
				scanf("%d",&a[i]);
						}
	for(i=1;i<2*n;i++){
		for(j=0;j<i;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
				//	temp--;
					flag=1;
					goto label;
								}else{
								//	temp++;
									}
						}

						label:
						if(flag){

						if(max<temp){
									max=temp;
											}
												temp--;
										//	temp=1;
											flag=0;
								}else{
										temp++;
										if(max<temp){
											max=temp;
													}
										}
					}
	cout<<max;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int i,j;
	int flag=0,n,temp=1,max=1;
	scanf("%d",&n);
	long long int a[2*n];
	for(i=0;i<2*n;i++){
				scanf("%lld",&a[i]);
						}
	for(i=1;i<2*n;i++){
		for(j=0;j<i;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
					flag=1;
					goto label;
								}
						}

						label:
						if(flag){

						if(max<temp){
									max=temp;
											}
												temp--;
												flag=0;
								}else{
										temp++;
										if(max<temp){
											max=temp;
													}
										}
					}
	cout<<max;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int i,j;
	int flag=0,n,temp=1,max=1;
	scanf("%lld",&n);
	long long int a[2*n];
	for(i=0;i<2*n;i++){
				scanf("%lld",&a[i]);
						}
	for(i=1;i<2*n;i++){
		for(j=0;j<i;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
					flag=1;
					goto label;
								}
						}

						label:
						if(flag){

						if(max<temp){
									max=temp;
											}
												temp--;
												flag=0;
								}else{
										temp++;
										if(max<temp){
											max=temp;
													}
										}
					}
	cout<<max;
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int i,j,temp=1,max=1,n,flag=0;;
	scanf("%lld",&n);
	long long int a[2*n];
	for(i=0;i<2*n;i++){
				scanf("%lld",&a[i]);
						}
	for(i=1;i<2*n;i++){
		for(j=0;j<i;j++){
				if(a[i]==a[j]){
					a[i]=-1;
					a[j]=-1;
				//	temp--;
					flag=1;
					goto label;
								}else{
								//	temp++;
									}
						}

						label:
						if(flag){

						if(max<temp){
									max=temp;
											}
												temp--;
										//	temp=1;
											flag=0;
								}else{
										temp++;
										if(max<temp){
											max=temp;
													}
										}
					}
	cout<<max;
	return 0;
}


#include <iostream>
#include <set>

using namespace std;
int main()
{
	int n, x, counter = 1, flag = 0, max = 1;
	set <int >s;
	cin >> n;
	cin >> x;
	s.insert(x);
	for (int i = 0; i < (2*n)-1; i++)
	{
		cin >> x;
		flag = 1;
		int temp = s.size();
		for (int j = 0; j < temp; j++)
		{
			if (s.count(x))
			{
				flag = 0;
				s.erase(x);
				if (counter > 0)counter--;
				break;
			}
		}
		if (flag)
		{
			s.insert(x);
			counter++;
			if (max < counter)
				max = counter;
		}
	}
	cout << max;
	return 0;
}


#include <iostream>
#include <set>

using namespace std;
int main()
{
	int n, x, counter = 1, flag = 0, max = 1;
	set <int >s;
	cin >> n;
	cin >> x;
	s.insert(x);
	for (int i = 0; i < (2*n)-1; i++)
	{
		cin >> x;
		flag = 1;
		int temp = s.size();

		if (s.count(x))
		{
			flag = 0;
			s.erase(x);
			if (counter > 0)counter--;
			break;
		}
		if (flag)
		{
			s.insert(x);
			counter++;
			if (max < counter)
				max = counter;
		}
	}
	cout << max;
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;
int main()
{
	int n, x, counter = 1, flag = 0, max = 1;
	vector<int>s;

	cin >> n;
	cin >> x;
	s.push_back(x);
	for (int i = 0; i < (2*n)-1; i++)
	{
		cin >> x;
		flag = 1;
		int temp = s.size();
		for (int j = 0; j < temp; j++)
		{
			if (x == s[j])
			{
				flag = 0;
				s.erase(s.begin() + j);
				if (counter > 0)counter--;
				break;
			}
		}
		if (flag)
		{
			s.push_back(x);
			counter++;
			if (max < counter)
				max = counter;
		}
	}
	cout << max;
	return 0;
}


#include <iostream>
#include <set>

using namespace std;
int main()
{
	long long n, x, counter = 1, flag = 0, max = 1;
	set <long long >s;
	cin >> n;
	cin >> x;
	s.insert(x);
	for (long long i = 0; i < (2 * n) - 1; i++)
	{
		cin >> x;
		flag = 1;
		long long temp = s.size();

		if (s.count(x))
		{
			flag = 0;
			s.erase(x);
			if (counter > 0)counter--;
			break;
		}
		if (flag)
		{
			s.insert(x);
			counter++;
			if (max < counter)
				max = counter;
		}
	}
	cout << max;
	return 0;
}


#include <iostream>
#include <set>

using namespace std;
int main()
{
	long long n, x, flag = 0, max = 0;
	set <long long >s;
	cin >> n;

	for (int i = 0; i < (2*n); i++)
	{
		cin >> x;

		flag = 0;
		if (s.count(x) == 1)
			flag = 1;

		if (flag)
			s.erase(x);
		else
			s.insert(x);

		if (s.size() > max)
			max = s.size();
	}
	cout << max;
	return 0;

}


#include <iostream>
#include <set>
#include <iterator>
using namespace std;
int main()
{  cin.tie(NULL);
    int i,j,n,max=0,k;

    cin>>n;
    set <int> g;
    for(i=0;i<(2*n);i++)
    {  cin>>j;

        if(g.find(j) == g.end())
        g.insert(j);
        else
            g.erase(j);
        if(g.size()>max) max=g.size();

    }
   cout<<max;

    return 0;
}


#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl
#define REP(i,n) for(Long i = 0; i < (Long)n; i++)
#define pb push_back
using namespace std;

typedef long long Long;

const Long MAX = 300;
Long a[MAX][MAX];

Long n,m;
bool f(Long r , Long c) {
	string row, column ;
	row = "0";
	column = "";
	Long lim;
	if(r == -1) {
		lim = -1;
	} else {
		lim = r * m + c;
	}

	for(Long j = 0; j < m; j++) {
		Long num = 0 * m + j;
		Long debe;
		if(num <= lim) {
			//debe ser 0
			debe = 0;
		} else {
			debe = 1;
		}
		if(a[0][j] == debe) {
			column += "0";
		} else {
			column += "1";
		}
	}

	for(Long i = 1; i < n; i++) {
		for(Long j = 0; j < m; j++) {

			Long num = i * m + j;

			Long bit = a[i][j];
			if(column[j] == '1') {
				bit = 1 - bit;
			}
			Long debe;
			if(num <= lim) {
				//debe ser 0
				debe = 0;
			} else {
				debe = 1;
			}
			if(j > 0) {
				if(row[i] == '1') {
					bit = 1 - bit;
				}
				if(bit != debe) {
					return false;
				}

			} else {
				if(bit == debe) {
					row += "0";
				} else {
					row += "1";
				}

			}
		}
	}

	cout << "YES" << endl;
	cout << row << endl << column << endl;
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> n >> m;
	REP(i , n) {
		REP(j , m) {
			cin >> a[i][j];
		}
	}

	if(f(-1 , -1)) {
		return 0;
	}

	REP(i , n) {
		bool ok = true;
		REP(j , m) {
			if(a[i][j] != a[i][0]) {
				ok = false;
				break;
			}
		}
		if(!ok) {
			REP(j , m){
				if(f(i, j)) {
					return 0;
				}
			}
			break;
		} else {
			if(f(i - 1 , m - 1)) {
				return 0;
			}
			if(f (i , m - 1)) {
				return 0;
			}
		}
	}
	cout << "NO" << endl;

	return 0;
}


#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl
#define REP(i,n) for(Long i = 0; i < (Long)n; i++)
#define pb push_back
using namespace std;

typedef long long Long;

const Long MAX = 300;
Long a[MAX][MAX];

Long n,m;
bool f(Long r , Long c) {
	string row, column ;
	row = "0";
	column = "";
	Long lim;
	if(r == -1) {
		lim = -1;
	} else {
		lim = r * m + c;
	}

	for(Long j = 0; j < m; j++) {
		Long num = 0 * m + j;
		Long debe;
		if(num <= lim) {
			//debe ser 0
			debe = 0;
		} else {
			debe = 1;
		}
		if(a[0][j] == debe) {
			column += '0';
		} else {
			column += '1';
		}
	}

	for(Long i = 1; i < n; i++) {
		for(Long j = 0; j < m; j++) {

			Long num = i * m + j;

			Long bit = a[i][j];
			if(column[j] == '1') {
				bit = 1 - bit;
			}
			Long debe;
			if(num <= lim) {
				//debe ser 0
				debe = 0;
			} else {
				debe = 1;
			}
			if(j > 0) {
				if(row[i] == '1') {
					bit = 1 - bit;
				}
				if(bit != debe) {
					return false;
				}

			} else {
				if(bit == debe) {
					row += '0';
				} else {
					row += '1';
				}

			}
		}
	}

	cout << "YES" << endl;
	cout << row << endl << column << endl;
	return true;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> n >> m;
	REP(i , n) {
		REP(j , m) {
			cin >> a[i][j];
		}
	}

	if(f(-1 , -1)) {
		return 0;
	}
	for(Long i = 0; i < n; i++) {
		for(Long j = 0; j < min(40LL, m); j++) {
			if(f(i , j)) {
				return 0;
			}
		}
	}
	cout << "NO" << endl;

	return 0;
}


#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int in[202][202], a[202][202], p[202], n, m;
string t;

bool issort(int i) {
	for(int j=2;j<=m;j++)
		if(a[i][j] < a[i][j-1])
			return false;
	return true;
}

bool isinsort(int i) {
	for(int j=2;j<=m;j++)
		if(a[i][j] > a[i][j-1])
			return false;
	return true;
}

bool ok() {
	string s;
	for(int i=1;i<=n;i++) {
		p[i] = 0;
		for(int j=1;j<=m;j++)
			p[i] += a[i][j];
	}
	int i;
	for(i=1;i<=n;i++) {
		if(p[i] == 0) s += '0';
		else if(p[i] == m) s += '1';
		else break;
	}
	if(i <= n) {
		if(issort(i)) s += '0';
		else if(isinsort(i)) s += '1';
		else return false;
		for(i=i+1;i<=n;i++) {
			if(p[i] == 0) s += '1';
			else if(p[i] == m) s += '0';
			else return false;
		}
	}
	cout << "YES" << endl;
	cout << s << endl << t << endl;
	return true;
}

int main()
{
	IO_OP;

	cin >> n >> m;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin >> in[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			a[i][j] = in[i][j];
	t = "";
	for(int i=1;i<=m;i++) {
		if(a[1][i]) {
			t += '1';
			for(int j=1;j<=n;j++)
				a[j][i] ^= 1;
		} else {
			t += '0';
		}
	}
	if(ok()) return 0;

	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			a[i][j] = in[i][j];
	t = "";
	for(int i=1;i<=m;i++) {
		if(a[n][i]) {
			t += '1';
			for(int j=1;j<=n;j++)
				a[j][i] ^= 1;
		} else {
			t += '0';
		}
	}
	if(ok()) return 0;

	cout << "NO" << endl;
}


#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define endl '\n'

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int in[202][202], a[202][202], p[202], n, m;
string t;

bool issort(int i) {
	for(int j=2;j<=m;j++)
		if(a[i][j] < a[i][j-1])
			return false;
	return true;
}

bool isinsort(int i) {
	for(int j=2;j<=m;j++)
		if(a[i][j] > a[i][j-1])
			return false;
	return true;
}

bool ok() {
	string s;
	for(int i=1;i<=n;i++) {
		p[i] = 0;
		for(int j=1;j<=m;j++)
			p[i] += a[i][j];
	}
	int i;
	for(i=1;i<=n;i++) {
		if(p[i] == 0) s += '0';
		else if(p[i] == m) s += '1';
		else break;
	}
	if(issort(i)) s += '0';
	else if(isinsort(i)) s += '1';
	else return false;
	for(i=i+1;i<=n;i++) {
		if(p[i] == 0) s += '1';
		else if(p[i] == m) s += '0';
		else return false;
	}
	cout << "YES" << endl;
	cout << s << endl << t << endl;
	return true;
}

int main()
{
	IO_OP;

	cin >> n >> m;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin >> in[i][j];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			a[i][j] = in[i][j];
	t = "";
	for(int i=1;i<=m;i++) {
		if(a[1][i]) {
			t += '1';
			for(int j=1;j<=n;j++)
				a[j][i] ^= 1;
		} else {
			t += '0';
		}
	}
	if(ok()) return 0;

	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			a[i][j] = in[i][j];
	t = "";
	for(int i=1;i<=m;i++) {
		if(a[n][i]) {
			t += '1';
			for(int j=1;j<=n;j++)
				a[j][i] ^= 1;
		} else {
			t += '0';
		}
	}
	if(ok()) return 0;

	cout << "NO" << endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> opset;
#define SZ(X) ((int)X.size())
#define ALL(I) I.begin(), I.end()
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define eps 1e-12
#define MXN 200005
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

int n, m;
bitset<205> a[205], st, rst;

bool ch(int row){
	st = a[0];
	if(!row) st = a[1];
	rst = st;
	for(int i = 0; i < m; i ++) rst.flip(i);
	for(int i = 0; i < n; i ++){
		if(i == row) continue;
		if(a[i] != st && a[i] != rst) return 0;
	}
	return 1;
}
void out(){
	cout << "YES\n";
	for(int i = 0; i < n; i ++){
		if(a[i] != st) cout << "1";
		else cout << "0";
	}
	cout << '\n';
	for(int i = 0; i < m; i ++) cout << st[i];
	cout << '\n';
	exit(0);
}

int main(){
	IOS;
	int x;
	cin >> n >> m;
	for(int i = 0; i < n; i ++){
		for(int j = 0; j < m; j ++){
			cin >> x;
			a[i].set(j, x ^ 1);
		}
	}
	if(ch(-1)) out();
	for(int i = 0; i < n; i ++){
		if(!ch(i)) continue;
		for(int j = 0; j < m; j ++){
			a[i].flip(j);
			if(a[i] == st || a[i] == rst) out();
		}
	}
	cout << "NO\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> opset;
#define SZ(X) ((int)X.size())
#define ALL(I) I.begin(), I.end()
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define eps 1e-12
#define MXN 200005
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

int n, m;
bitset<205> a[205], st, rst;

bool ch(int row){
	st = a[0];
	if(!row) st = a[1];
	rst = st;
	for(int i = 0; i < m; i ++) rst.flip(i);
	for(int i = 0; i < n; i ++){
		if(i == row) continue;
		if(a[i] != st && a[i] != rst) return 0;
	}
	return 1;
}
void out(){
	cout << "YES\n";
	for(int i = 0; i < n; i ++){
		if(a[i] != st) cout << "1";
		else cout << "0";
	}
	cout << '\n';
	for(int i = 0; i < m; i ++) cout << st[i];
	cout << '\n';
	exit(0);
}

int main(){
	IOS;
	int x;
	cin >> n >> m;
	for(int i = 0; i < n; i ++){
		for(int j = 0; j < m; j ++){
			cin >> x;
			a[i].set(j, x ^ 1);
		}
	}
	if(ch(-1)) out();
	for(int i = 0; i < n; i ++){
		x = ch(i);
		for(int j = 0; j < m; j ++){
			a[i].flip(j);
			if((a[i] == st || a[i] == rst) && x) out();
		}
	}
	cout << "NO\n";
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<map>
#include<queue>

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define pb push_back
#define ms(a,x) memset(a,x,sizeof(a))
#define endl '\n'
using namespace std;

const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef pair<int, int> pii;

int n,m;
int a[205][205];
int ans[205][205];
int c[205],r[205];
bool check(){
    forn(i,m) c[i]=a[0][i]^ans[0][i];
    forn(i,n) r[i]=a[i][0]^ans[i][0]^c[0];
    fore(i,1,m-1){
        fore(j,1,n-1){
            if((ans[i][j]^a[i][j])!=(r[i]^c[j]))
            return false;
        }
    }
    return true;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    forn(i,n){
        forn(j,m){
            cin>>a[i][j];
            ans[i][j]=1;
        }
    }
    int x=0,y=0;
    forn(k,n*m){
        if(check()==true){
            //cout<<x<<' '<<y;
            cout<<"YES\n";
            forn(i,n) cout<<r[i];
            cout<<endl;
            forn(i,m) cout<<c[i];
            return 0;
        }
        ans[x][y]=0;
        y++;
        if(y==m){
            y=0;x++;
        }
    }
    cout<<"NO";
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<map>
#include<queue>

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define pb push_back
#define ms(a,x) memset(a,x,sizeof(a))
#define endl '\n'
using namespace std;

const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef pair<int, int> pii;

int n,m;
int a[205][205];
int ans[205][205];
int c[205],r[205];
bool check(){
    forn(i,m) c[i]=a[0][i]^ans[0][i];
    forn(i,n) r[i]=a[i][0]^ans[i][0]^c[0];
    forn(i,n){
        forn(j,m){
            if((ans[i][j]^a[i][j])!=(r[i]^c[j]))
            return false;
        }
    }
    return true;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    forn(i,n){
        forn(j,m){
            cin>>a[i][j];
            ans[i][j]=1;
        }
    }
    int x=0,y=0;
    forn(k,n*m){
        if(check()==true){
            //cout<<x<<' '<<y;
            cout<<"YES\n";
            forn(i,n) cout<<r[i];
            cout<<endl;
            forn(i,m) cout<<c[i];
            return 0;
        }
        ans[x][y]=0;
        y++;
        if(y==m){
            y=0;x++;
        }
    }
    cout<<"NO";
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#include<map>
#include<queue>

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define pb push_back
#define ms(a,x) memset(a,x,sizeof(a))
#define endl '\n'
using namespace std;

const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef pair<int, int> pii;

int n,m;
int a[205][205];
int ans[205][205];
int c[205],r[205];
bool check(){
    forn(i,m) c[i]=a[0][i]^ans[0][i];
    forn(i,n) r[i]=a[i][0]^ans[i][0]^c[0];
    forn(i,n){
        forn(j,m){
            if((ans[i][j]^a[i][j])!=(r[i]^c[j]))
            return false;
        }
    }
    return true;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    forn(i,n){
        forn(j,m){
            cin>>a[i][j];
            ans[i][j]=1;
        }
    }
    int x=0,y=0;
    forn(k,n*m){
        if(check()==true){
            cout<<x<<' '<<y;
            cout<<"YES\n";
            forn(i,n) cout<<r[i];
            cout<<endl;
            forn(i,m) cout<<c[i];
            return 0;
        }
        ans[x][y]=0;
        y++;
        if(y==m){
            y=0;x++;
        }
    }
    cout<<"NO";
}


#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;
typedef long long LL;

inline int read() {
    int x=0,f=1; char ch=getchar();
    while (!(ch>='0'&&ch<='9')) {if (ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9') {x=x*10+(ch-'0'); ch=getchar();}
    return x*f;
}

const int N = 205;

int n,m;
int a[N][N],b[N][N],d[N][N];
int r[N],c[N];

int main() {

	n=read(),m=read();
	rep(i,1,n) rep(j,1,m) a[i][j]=read();
	rep(num,0,n*m)
{
int tmp=0;
rep(i,1,n) {
		rep(j,1,m) {
			++tmp; if (tmp<=n*m-num) b[i][j]=0; else b[i][j]=1;
		}
	}

	r[1]=0; rep(i,1,m) c[i]=a[1][i]^b[1][i]^r[1];
	rep(i,2,n) r[i]=a[i][1]^b[i][1]^c[1];
	rep(i,1,n) rep(j,1,m) d[i][j]=a[i][j]^r[i]^c[j];
	bool flag=1;
	rep(i,1,n) rep(j,1,m) if (b[i][j]!=d[i][j]) flag=0;
	if (flag) {
		puts("YES");
		rep(i,1,n) printf("%d",r[i]); puts("");
		rep(i,1,m) printf("%d",c[i]); puts("");
		return 0;
	}

	r[1]=1; rep(i,1,m) c[i]=a[1][i]^b[1][i]^r[1];
	rep(i,2,n) r[i]=a[i][1]^b[i][1]^c[1];
	rep(i,1,n) rep(j,1,m) d[i][j]=a[i][j]^r[i]^c[j];
	flag=1;
	rep(i,1,n) rep(j,1,m) if (b[i][j]!=d[i][j]) flag=0;
	if (flag) {
		puts("YES");
		rep(i,1,n) printf("%d",r[i]); puts("");
		rep(i,1,m) printf("%d",c[i]); puts("");
		return 0;
	}
}

	puts("NO");

	return 0;

}


#include <bits/stdc++.h>
#define mod 998244353
#define eps 1e-9
#define inf (ll)1e18

using namespace std;

typedef long long ll;
typedef long double ld;

ll n, m, M[205][205], ok, r[205], c[205];

void solve()
{
    for (int k=1; k<=m+1; k++) // coloana pe care incepe sa fie 1
    {
        int no=0;
        memset(c, 0, sizeof(c));
        memset(r, 0, sizeof(r));
        for (int j=1; j<=m; j++)
        {
            if (j<k)
            {
                if (M[1][j]==0) continue;
                c[j]=1;
            } else
            {
                if (M[1][j]==1) continue;
                c[j]=1;
            }
        }
        if (k==m+1)
            ok=0;
        else
            ok=1;
        for (int i=2; i<=n; i++)
        {
            int x = 0, ok1 = 1, ok2 = 1;
            for (int j = 1; j <= m; j++) {
                if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                ok1 = 0;
            }
            x = 1;
            for (int j = 1; j <= m; j++) {
                if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                ok2 = 0;
            }
            if (ok1)
                continue;
            if (ok2) {
                r[i] = 1;
                continue;
            }
            if (ok==0)
            {
                x = 0, ok1 = 1, ok2 = 1;
                for (int j = 1; j <= m; j++) {
                    if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                    if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                    if (ok==0)
                        ok = 1, j--;
                    else
                        ok1 = 0;
                }

                x = 1, ok=0;
                for (int j = 1; j <= m; j++) {
                    if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                    if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                    if (ok==0)
                        ok = 1, j--;
                    else
                        ok2 = 0;
                }
                if (ok1)
                    continue;
                if (ok2) {
                    r[i] = 1;
                    continue;
                }
            }
            no = 1;
            break;
        }
        if (no==0)
        {
            cout<<"YES\n";
            for (int i=1; i<=n; i++)
                cout<<r[i];
            cout<<endl;
            for (int j=1; j<=m; j++)
                cout<<c[j];
            exit(0);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    for (int i=1; i<=n; i++)
        for (int j=1; j<=m; j++)
            cin>>M[i][j];

    solve();
    for (int j=1; j<=m; j++)
        M[1][j] = M[1][j]^1;
    solve();
    cout<<"NO";

    return 0;
}


#include <bits/stdc++.h>
#define mod 998244353
#define eps 1e-9
#define inf (ll)1e18

using namespace std;

typedef long long ll;
typedef long double ld;

ll n, m, M[205][205], ok, r[205], c[205];

void solve()
{
    for (int k=0; k<=m; k++) // coloana pe care incepe sa fie 1
    {
        int no=0;
        memset(c, 0, sizeof(c));
        memset(r, 0, sizeof(r));
        for (int j=1; j<=m; j++)
        {
            if (j<k)
            {
                if (M[1][j]==0) continue;
                c[j]=1;
            } else
            {
                if (M[1][j]==1) continue;
                c[j]=1;
            }
        }
        if (k==0)
            ok=0;
        else
            ok=1;
        for (int i=2; i<=n; i++)
        {
            int x = 0, ok1 = 1, ok2 = 1;
            for (int j = 1; j <= m; j++) {
                if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                ok1 = 0;
            }
            x = 1;
            for (int j = 1; j <= m; j++) {
                if ((M[i][j] + c[j] + x) % 2 == 0 && ok == 0) continue;
                if ((M[i][j] + c[j] + x) % 2 == 1 && ok == 1) continue;
                ok2 = 0;
            }
            if (ok1) continue;
            if (ok2) {
                r[i] = 1;
                continue;
            }
            no = 1;
            break;
        }
        if (no==0)
        {
            cout<<"YES\n";
            for (int i=1; i<=n; i++)
                cout<<r[i];
            cout<<endl;
            for (int j=1; j<=m; j++)
                cout<<c[j];
            exit(0);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin>>n>>m;
    for (int i=1; i<=n; i++)
        for (int j=1; j<=m; j++)
            cin>>M[i][j];

    solve();
    cout<<"NO";

    return 0;
}