#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, ar[105];
  memset(ar, 0, sizeof(ar));
  int n;
  cin >> n;
  vector<int> v;
  for (i = 1; i <= (2 * n); i++) {
    int val;
    cin >> val;
    v.push_back(val);
  }
  int fre = 0;
  for (int i = 0; i < (2 * n); i++) {
    if (ar[v[i]] == 1) continue;
    for (int j = i + 1; j < (2 * n); j++) {
      if (v[i] == v[j]) {
        ar[v[j]] = 1;
        break;
      }
      if (ar[v[j]] == 1) {
        continue;
      }
      fre++;
    }
  }
  cout << fre;
  return 0;
}
