import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int a, int b) {

    int height(int n) { return n * (n + 1) / 2; }

    for (int i = 1; i < 999; i++) {
        int x = height(i);
        int y = height(i + 1);

        int dx = x - a;
        int dy = y - b;
        if (dx == dy && dx > 0)
            return dx;


        /*

        if (a >= x || b >= y) continue;
        if (x < a || y < b) continue;
        int s = x + y - (a + b);
        if (s > 1 && s % 2 == 0) {
            return s / 2;
        }
        */
    }
    assert(false);
}

void main() {
    auto ab = readints;
    int a = ab[0], b = ab[1];

    auto ans = calc(a, b);
    writeln(ans);
}
