1. 标准贪心做法
#include<bits/stdc++.h>
using namespace std;

int main(){

    int n;
    cin>>n;
    vector<long> cards;
    long a;
    for(int i = 0 ; i< n ; i++){
        cin>>a;
        cards.push_back(a);
    }

    sort(cards.begin(),cards.end(),greater<long>());

    int ans = 0;
    for(int i = 0; i< n; i++){
        //牛牛
        if(!(i&1)){
            ans+= cards[i];
        }else{
            ans-= cards[i];
        }
    }

    cout<<ans<<endl;

    return 0;
}