#include<iostream>
using namespace std;
int main()
{
	int n,temp,alec=0,max=0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> temp;
		if (i % 2 == 0)alec += temp;
		else max += temp;

	}
	cout << alec - max;

	return 0;
}