#include <bits/stdc++.h>   using namespace std;   const int N = 106, INF = 0x3f3f3f3f;   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;   }   int n, a[N << 1];   int couple[N][2];   int main() {     n = read();     for (int i = 1; i <= n << 1; i++) {       a[i] = read();       if (!couple[a[i]][0])         couple[a[i]][0] = i;       else         couple[a[i]][1] = i;     }     int ans = 0;     for (int i = 1; i <= (n << 1); i += 2) {       if (a[i] == a[i + 1])         continue;       else {         ans += couple[a[i]][1] - couple[a[i]][0] - 1;         for (int j = couple[a[i]][1] - 1; j >= i; j--)           if (couple[a[j]][0] == j)             a[++couple[a[j]][0]] = a[j];           else             a[++couple[a[j]][1]] = a[j];         a[couple[a[i]][1] = i + 1] = a[i];       }     }     printf( %d n , ans);   }   