#include <iostream>
using namespace std;
int main()
{
int n = 5;
int op_limit = 1;
int op_done = 0;
bool add = true;
int sum = 0;
for(int i = 1; i <= n; ++i) {
if(op_done == op_limit) {
op_done = 0;
++op_limit;
add = !add;
}
sum += (add? i : -i);
++op_done;
}
std::cout << sum;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewoJaW50IG4gPSA1OwoJaW50IG9wX2xpbWl0ID0gMTsKCWludCBvcF9kb25lID0gMDsKCWJvb2wgYWRkID0gdHJ1ZTsKCWludCBzdW0gPSAwOwoJZm9yKGludCBpID0gMTsgaSA8PSBuOyArK2kpIHsKCSAgICBpZihvcF9kb25lID09IG9wX2xpbWl0KSB7CgkgICAgICAgIG9wX2RvbmUgPSAwOwoJICAgICAgICArK29wX2xpbWl0OwoJICAgICAgICBhZGQgPSAhYWRkOwoJICAgIH0KCSAgICBzdW0gKz0gKGFkZD8gaSA6IC1pKTsKCSAgICArK29wX2RvbmU7Cgl9CglzdGQ6OmNvdXQgPDwgc3VtOwp9