#include <iostream>
using namespace std;
/*
Rezolva problema fara if
*/
int main() {
int length, currentNo, evensSum = 0, oddsSum = 0;
cin >> length;
for (int i = 1; i <= length; ++i) {
cin >> currentNo;
if (i % 2 == 0) {
evensSum += currentNo;
} else {
oddsSum += currentNo;
}
}
cout << evensSum - oddsSum;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwovKgpSZXpvbHZhIHByb2JsZW1hIGZhcmEgaWYKKi8KCmludCBtYWluKCkgewoJaW50IGxlbmd0aCwgY3VycmVudE5vLCBldmVuc1N1bSA9IDAsIG9kZHNTdW0gPSAwOwoJY2luID4+IGxlbmd0aDsKCWZvciAoaW50IGkgPSAxOyBpIDw9IGxlbmd0aDsgKytpKSB7CgkJY2luID4+IGN1cnJlbnRObzsKCQlpZiAoaSAlIDIgPT0gMCkgewoJCQlldmVuc1N1bSArPSBjdXJyZW50Tm87CgkJfSBlbHNlIHsKCQkJb2Rkc1N1bSArPSBjdXJyZW50Tm87CgkJfQoJfQoJY291dCA8PCBldmVuc1N1bSAtIG9kZHNTdW07CglyZXR1cm4gMDsKfQ==