#include <iostream>
using namespace std;
const int MAX_LENGTH = 100000;
int main() {
int n, v[MAX_LENGTH + 1], sum_even_no = 0, sum_odd_no = 0;
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
int i = 1;
while (i <= n) {
if (i % 2 == 0) {
sum_even_no += v[i];
} else {
sum_odd_no += v[i];
}
++i;
}
cout << sum_even_no - sum_odd_no;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9MRU5HVEggPSAxMDAwMDA7CgppbnQgbWFpbigpIHsKICAgIGludCBuLCB2W01BWF9MRU5HVEggKyAxXSwgc3VtX2V2ZW5fbm8gPSAwLCBzdW1fb2RkX25vID0gMDsKICAgIGNpbiA+PiBuOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgY2luID4+IHZbaV07CiAgICB9CiAgICBpbnQgaSA9IDE7CiAgICB3aGlsZSAoaSA8PSBuKSB7CiAgICAgICAgaWYgKGkgJSAyID09IDApIHsKICAgICAgICAgICAgc3VtX2V2ZW5fbm8gKz0gdltpXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBzdW1fb2RkX25vICs9IHZbaV07CiAgICAgICAgfQogICAgICAgICsraTsKICAgIH0KICAgIGNvdXQgPDwgc3VtX2V2ZW5fbm8gLSBzdW1fb2RkX25vOwogICAgcmV0dXJuIDA7Cn0=