#include <cstdio>
template<class T>
T abs(T val) {
return val >= 0 ? val : -val;
}
int invert(int n) {
int x = -abs(2*n);
const int incr = n > 0 ? -1 : 1;
while (x++ < 0) {
n += incr;
}
return n;
}
void test(int n) {
printf("%d inverted is %d\n", n, invert(n));
}
int main(int argc, char** argv) {
test(1);
test(22);
test(-22);
test(55);
test(0);
return 0;
}