#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  set<int> s;
  for(int i = 0; i < n; i++){
    //cout << s.size() << endl;
    int a; cin >> a;
    if(s.count(a))
       s.erase(a);
    else
       s.insert(a);
  }
  cout << s.size() << endl;
}

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  int n;
  cin >> n;
  vector<ll>a(n);
  ll sum=0;
  for(int i=0;i<n;++i) cin >> a[i];
  for(int i=0;i<n-1;++i) {
    if(a[i]>a[i+1]){
      sum+=a[i]-a[i+1];
      a[i+1]=a[i];
    }
  }
  cout << sum << endl;
  return 0;
}
