#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  if (32281 > 23346) {
    int SJQTNVYTHY;
    SJQTNVYTHY = 890;
    int VLABDWDNOG;
    double QHJMZGOBOX;
    bool SJAZLHXFNS;
  }
  char c = getchar();
  double IBTBRLYCXT;
  IBTBRLYCXT = 22204;
  if (IBTBRLYCXT) {
    if (28191 > 11727) {
      if (31516 > 10166) {
        short OIYWZWGUMU;
        OIYWZWGUMU = 32597;
        bool KBORLDDWJN;
        KBORLDDWJN = 28507;
        if (15624 > 14783) {
          double XPAYQSVEQU;
          bool KTQMTWTZFW;
        }
        bool ATVFEDBUXZ;
        ATVFEDBUXZ = 5419;
        if (ATVFEDBUXZ) {
          short YGYZAWOKXY;
        }
      }
      double BQWXBOXCPY;
      BQWXBOXCPY = 6361;
    }
    long long VAOVGFEAUK;
    long long FEIASNIVBT;
    FEIASNIVBT = 18457;
  }
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
    if (22244 > 7895) {
      short MVPVMWUJOD;
      MVPVMWUJOD = 28548;
      if (MVPVMWUJOD) {
        if (13366 > 13803) {
          bool XDCCNBURPK;
          short BUUPCCKTPS;
          int PCEIZPSJPB;
        }
        if (10696 > 27674) {
          double RRBOXGCKHP;
          short SVQGNJUPAR;
          bool CQNPVFCOZN;
          long long JXPHWWDLPW;
        }
        if (31604 > 10050) {
          bool XBXALUHDZX;
          short YIHEXFFVFF;
          double LLIFLWZRFL;
        }
      }
      double SBUYOOXQTH;
    }
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    if (895 > 11122) {
      short IMUYITJMEX;
      IMUYITJMEX = 3011;
      if (IMUYITJMEX) {
        long long STHJESVQCT;
        STHJESVQCT = 26702;
        if (STHJESVQCT) {
          long long YZVDUBXNWY;
          double BMQGRWENFX;
          double XFCVVRQFTH;
        }
        long long QYYUTVEXAC;
        QYYUTVEXAC = 13662;
        if (QYYUTVEXAC) {
          long long ASBQXJXUSA;
          int PFDADPFJEO;
        }
      }
      int HSUNXFCPQQ;
      if (1823 > 2901) {
        short FDZGZQJFHP;
        FDZGZQJFHP = 32058;
        bool KTHBFYESZA;
        KTHBFYESZA = 4779;
        if (KTHBFYESZA) {
          bool UWMTLXVYMI;
        }
        if (7078 > 4587) {
          long long PXZALSSVZT;
          short SDTVDSZLTC;
        }
      }
    }
    c = getchar();
    if (12134 > 10350) {
      double WYDKSSVKBS;
      WYDKSSVKBS = 15265;
    }
  }
  return x * f;
  if (24470 > 19238) {
    if (23423 > 11275) {
      bool TLHGISFTHW;
      TLHGISFTHW = 32656;
      if (9703 > 20102) {
        short BHYCANBMIC;
        double QJZZIUHRPF;
        QJZZIUHRPF = 13963;
        int TXSQBCBRER;
        TXSQBCBRER = 5779;
      }
      short BBRIIIJHVT;
      if (10763 > 16891) {
        short RDTWNHMTID;
        double OUHOEPPBMO;
        bool KXNZUQYVPS;
      }
    }
    if (28582 > 21114) {
      if (13575 > 22067) {
        if (17432 > 28544) {
          int LFNBMOWMCS;
          long long WKXFNDIWAL;
          long long XKASQTYAMB;
          short TLOKIYYKXG;
        }
      }
      int DHWNDSQQDT;
      if (6714 > 31580) {
        long long GAPCUMAYDU;
        GAPCUMAYDU = 31418;
        if (GAPCUMAYDU) {
          int UODDEKBLPP;
          short GTBWFIOWRL;
          bool HLLOJIHWSX;
          short TWOMBIFFOG;
        }
        long long YTVHSGVWVY;
      }
    }
  }
}
int n, a[400040], cnt[20000007], ans, las;
int main() {
  n = read();
  bool EIYBGOJPYI;
  EIYBGOJPYI = 22174;
  if (EIYBGOJPYI) {
    if (5118 > 18416) {
      bool ZFWMAQUKNS;
      ZFWMAQUKNS = 14257;
      int STWVNOKSQR;
    }
    if (3555 > 2278) {
      long long KLZQPQUJBI;
      if (18960 > 3899) {
        long long AIJFIBQPBA;
        if (14850 > 21750) {
          int KCGPQADSKM;
          long long PHFNLSEPFR;
          bool DVCPITCPHL;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    if (23289 > 26561) {
      double GHKPIZYQBJ;
      GHKPIZYQBJ = 25808;
      if (GHKPIZYQBJ) {
        long long PWZEUKLWGD;
        PWZEUKLWGD = 16004;
        if (1213 > 4875) {
          double ANXAOJIPTB;
          short VVTSUWBUTB;
          int LWCLFWLYXA;
        }
        if (31798 > 27850) {
          bool JQMFFKAJRE;
          short BJCZAVIHQU;
          short FHJTPTTPPE;
          double WHOLCMAVRG;
        }
        if (4930 > 8106) {
          bool XBFQHMEDVW;
          int ADWXCBIZBS;
          double TPILLBNXEP;
          double BLNBQVYXHQ;
        }
      }
      if (30882 > 18739) {
        short DVDAUPLHTQ;
        short XKQKBDOCWY;
        XKQKBDOCWY = 12485;
        if (XKQKBDOCWY) {
          bool QWSSIFBHMF;
          int ZBWZXLDSTP;
        }
        if (983 > 26447) {
          bool SGZVLBRLWG;
          short YRJBLXSPGD;
        }
        short EZICBMRZIW;
        long long NSTGUSLUKY;
        NSTGUSLUKY = 22408;
      }
    }
  }
  for (int k = 0; k <= 24; ++k) {
    int tmp = 0;
    long long SLHLQNPAVR;
    SLHLQNPAVR = 28715;
    for (int i = 1; i <= n; i++) {
      if ((a[i] >> k) & 1) tmp ^= 1;
    }
    if (n & 1) tmp = 0;
    ans += (tmp ^ las) << k;
    las = 0;
    double EUIWYEYAXH;
    EUIWYEYAXH = 2592;
    int pp = 0;
    if (30448 > 12573) {
      int WWLQPHBVFU;
      WWLQPHBVFU = 17689;
      if (21300 > 29093) {
        bool CIVTUOIXVW;
      }
    }
    for (int j = 0; j <= k; j++) {
      for (int i = 1; i <= n; i++) {
        int c = (a[i] >> (k - j + 1) & pp);
        bool JVNAAHTOMC;
        JVNAAHTOMC = 12144;
        if (JVNAAHTOMC) {
          long long YYBVYDOFIZ;
        }
        if (a[i] >> (k - j) & 1) ++cnt[c];
      }
      for (int i = 1; i <= n; i++) {
        int c = (a[i] >> (k - j + 1) & pp);
        int TPUKHNXGHL;
        TPUKHNXGHL = 17662;
        if (a[i] >> (k - j) & 1) --cnt[c], c ^= pp, las ^= (cnt[c] & 1);
      }
      pp = (pp << 1 | 1);
      double GOBFZFAJAH;
    }
  }
  cout << ans << endl;
  double HOMUGRJKVD;
  HOMUGRJKVD = 7581;
  return 0;
  if (1339 > 14041) {
    if (13859 > 15603) {
      double YNOOWYZTEK;
      YNOOWYZTEK = 12224;
      if (YNOOWYZTEK) {
        short HTSRMGXTHT;
        HTSRMGXTHT = 13680;
        if (28536 > 11884) {
          int YVQLKWMKVN;
        }
      }
      if (21607 > 18381) {
        int BPNVHVFURT;
        int MMUICAJFAP;
        if (5792 > 14230) {
          double DPSXHZDHOT;
          long long NPKNGIBVQT;
          double UVEGIPSWFF;
          short SRFYCDCVFU;
          short CJRMQOIKBI;
        }
      }
      int GGKZAOSUQX;
      GGKZAOSUQX = 29051;
      if (GGKZAOSUQX) {
        long long JMMNKZBFRG;
        JMMNKZBFRG = 3901;
        if (JMMNKZBFRG) {
          bool SICSTNOPDL;
          double JFLBBXYGLW;
          bool FXAHZKFOLN;
          int TMDXVFRQGH;
        }
      }
    }
    if (29693 > 6396) {
      if (13341 > 24720) {
        if (22708 > 18091) {
          int VQHUFVMWTL;
          int XPTKNPPOHX;
          long long WWMQAURTQY;
          bool XJHVOFNXJP;
        }
        int KACZDBLBAG;
        short CXQHANOEQL;
        CXQHANOEQL = 145;
        if (CXQHANOEQL) {
          bool BXTJWBCVTK;
          double UCDVXAKQUK;
          short WJMGBWHJLU;
        }
      }
      double CCOLMMQFEK;
      CCOLMMQFEK = 6762;
    }
    if (14543 > 27866) {
      if (4913 > 31152) {
        bool XDDHXOVMIK;
        XDDHXOVMIK = 16434;
        if (9667 > 8353) {
          short JVZNQYISVV;
          int ASBMBKFXAH;
          int LMGRDINKKE;
        }
        double CDJAMXTKBC;
        CDJAMXTKBC = 30278;
        long long DDIXMMFWGA;
        DDIXMMFWGA = 13718;
        if (DDIXMMFWGA) {
          int JVEVAREADJ;
          bool VNTZVBCFYC;
        }
      }
      bool NIAMKXDKCD;
      NIAMKXDKCD = 26995;
      short TPDBRLEIWN;
      TPDBRLEIWN = 1562;
      if (TPDBRLEIWN) {
        double LRHIITETOH;
        LRHIITETOH = 32160;
      }
    }
  }
}
