#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  T f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
  x *= f;
}
int main() {
  long long n;
  read(n);
  if (n == 0) {
    printf("0\n");
    return 0;
  }
  if ((n + 1) & 1)
    printf("%I64d\n", n + 1);
  else
    printf("%I64d\n", (n + 1) >> 1);
  return 0;
}
