#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int n, m;
int ans;
int main() {
scanf("%d %d", &n, &m);
int dif = abs(n - m);
if (dif % 2 == 0) {
int cnt = dif / 2;
for (int i = 1;i <= cnt;++i) {
ans += (i * 2);
}
}
else {
int cnt = dif / 2;
for (int i = 1;i <= cnt;++i) {
ans += (i * 2);
}
ans += (cnt + 1);
}
printf("%d\n", ans);
//system("pause");
return 0;
}