#include using namespace std; const int MAX = 1 << 25; int tr[MAX]; int main() { int n; scanf("%d", &n); vector pref{0}; for(int i = 0; i < n; ++i) { int x; scanf("%d", &x); pref.push_back(pref.back() + x); } int answer = 0; for(int which = 0; (1 << which) <= pref.back(); ++which) { const int half = 1 << which; const int mod = 2 * half; assert(2 * mod <= MAX); for(int i = 0; i < 2 * mod; ++i) tr[i] = 0; for(int x : pref) { x %= mod; bool flag = false; int low = (x + 1) % mod, high = (x + half) % mod; if(low > high) { flag = true; pair tmp = {high + 1, low - 1}; low = tmp.first, high = tmp.second; } assert(0 <= low && low <= high && high < mod); low += mod, high += mod; int cnt = tr[low]; if(low != high) cnt += tr[high]; while(low < high - 1) { if(low % 2 == 0) cnt += tr[low+1]; if(high % 2) cnt += tr[high-1]; low /= 2, high /= 2; } if(flag) cnt = tr[1] - cnt; if(cnt % 2 != 0) answer ^= half; for(int i = mod + x; i >= 1; i /= 2) ++tr[i]; } } printf("%d\n", answer); }