#include <bits/stdc++.h>   using namespace std;   int G[100010];   int A[1000];   int g(int q) {     int n = 2, m, i, g, t, nn;     memset(A, 0, sizeof(A));     n = 2;     nn = -1;     while (q >= n * (n + 1) / 2) {       m = q - n * (n + 1) / 2;       if (m % n != 0) {         n++;         continue;       }       m /= n;       t = 0;       for (i = m + 1; i < m + n + 1; i++) {         t ^= G[i];       }       A[t] = 1;       if ((t == 0) && (nn == -1)) nn = n;       n++;     }     for (i = 0; i < 1000; i++)       if (A[i] == 0) break;     G[q] = i;     return nn;   }   int main() {     int i, n, k, j, d;     memset(G, 0xFF, sizeof(G));     scanf( %d , &n);     for (i = 0; i < n; i++) g(i);     printf( %d n , g(n));     return 0;   }   