import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    int N;
    int M;
    int[][] A;
    int[][] target;
    boolean[][] banned;
    int ci, cj;
    ArrayList<Integer> moves;

    int[] di = { 0, 1, 0, -1, 1, -1, 1, -1 };
    int[] dj = { 1, 0, -1, 0, 1, -1, -1, 1 };

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        N = in.nextInt();
        M = in.nextInt();
        A = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = in.nextInt();
            }
        }
        target = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                target[i][j] = in.nextInt();
            }
        }

        moves = new ArrayList<Integer>();

        // edge cases
        if (N == 1 || M == 1) {
            handleEdgeCase(out);
            return;
        }

        banned = new boolean[N][M];
        ci = -1;
        cj = -1;
        for (int i = 0; i < N && ci == -1; i++) {
            for (int j = 0; j < M && ci == -1; j++) {
                if (A[i][j] == target[0][0]) {
                    ci = i;
                    cj = j;
                }
            }
        }
        if (ci == -1) {
            out.println(-1);
            return;
        }
        moves.add(ci);
        moves.add(cj);
        for (int i = N - 1; i > 1; i--) {
            for (int j = 0; j < M; j++) {
                if (!placeCell(i, j)) {
                    out.println(-1);
                    return;
                }
            }
        }

        // 2xM
        for (int j = M - 1; j >= 0; j--) {
            for (int i = 1; i >= 0; i--) {
                if (!placeCell(i, j)) {
                    out.println(-1);
                    return;
                }
            }
        }

        out.println(moves.size() / 2 - 1);
        for (int i = 0; i < moves.size(); i += 2) {
            int pi = moves.get(i) + 1;
            int pj = moves.get(i + 1) + 1;
            out.println(pi + " " + pj);
        }
    }

    private void handleEdgeCase(PrintWriter out) {
        boolean rev = false;
        if (M == 1) {
            int[][] B = new int[M][N];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    B[j][i] = A[i][j];
                }
            }
            A = B;

            int[][] BT = new int[M][N];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    BT[j][i] = target[i][j];
                }
            }
            target = BT;

            rev = true;
            int aux = N; N = M; M = aux;
        }

        boolean ok = false;
        for (int a = 0; a < M && !ok; a++) {
            for (int b = 0; b < M && !ok; b++) {
                if (valid(a, b)) {
                    ok = true;
                }
            }
        }

        if (!ok) {
            out.println(-1);
            return;
        }

        out.println(moves.size() / 2 - 1);
        for (int i = 0; i < moves.size(); i += 2) {
            int pi = moves.get(i) + 1;
            int pj = moves.get(i + 1) + 1;
            if (!rev) {
                out.println(pi + " " + pj);
            }
            else {
                out.println(pj + " " + pi);
            }
        }
    }

    private boolean valid(int a, int b) {
        moves.clear();
        if (a == b) {
            return false;
        }

        int dir = a > b ? -1 : 1;
        int[] start = new int[M];
        for (int i = 0; i < M; i++) {
            start[i] = A[0][i];
        }
        moves.add(0); moves.add(a);
        for (int i = a; i != b; i += dir) {
            int aux = start[i];
            start[i] = start[i + dir];
            start[i + dir] = aux;
            moves.add(0); moves.add(i + dir);
        }

        boolean ok = true;
        for (int i = 0; i < M; i++) {
            if (start[i] != target[0][i]) {
                ok = false;
            }
        }

        return ok;
    }

    private boolean placeCell(int ti, int tj) {
        int t = target[ti][tj];
        int pi = -1;
        int pj = -1;
        for (int i = 0; i < N && pi == -1; i++) {
            for (int j = 0; j < M && pi == -1; j++) {
                if (!banned[i][j] && A[i][j] == t) {
                    pi = i;
                    pj = j;
                }
            }
        }

        if (pi == -1) {
            return false;
        }

        int[][] simplePath = computePath(pi, pj, ti, tj);
        for (int p = 1; p < simplePath.length; p++) {
            int previ = simplePath[p - 1][0];
            int prevj = simplePath[p - 1][1];
            int crti = simplePath[p][0];
            int crtj = simplePath[p][1];
            if (ci != previ || cj != prevj) {
                banned[previ][prevj] = true;
                int[][] path = computePath(ci, cj, crti, crtj);
                executeMoves(path);
                banned[previ][prevj] = false;
                int aux = A[ci][cj];
                A[ci][cj] = A[previ][prevj];
                A[previ][prevj] = aux;
                ci = previ;
                cj = prevj;
                moves.add(ci);
                moves.add(cj);
            }
            else {
                int aux = A[ci][cj];
                A[ci][cj] = A[crti][crtj];
                A[crti][crtj] = aux;
                ci = crti;
                cj = crtj;
                moves.add(ci);
                moves.add(cj);
            }
        }

        banned[ti][tj] = true;
        return true;
    }

    private void executeMoves(int[][] path) {
        if (ci != path[0][0] || cj != path[0][1]) {
            throw new RuntimeException();
        }

        int K = path.length;
        for (int m = 0; m < K - 1; m++) {
            int crti = path[m][0];
            int crtj = path[m][1];
            int nexti = path[m + 1][0];
            int nextj = path[m + 1][1];
            int aux = A[crti][crtj];
            A[crti][crtj] = A[nexti][nextj];
            A[nexti][nextj] = aux;
            moves.add(nexti);
            moves.add(nextj);
        }

        ci = path[K - 1][0];
        cj = path[K - 1][1];
    }

    private int[][] computePath(int si, int sj, int ti, int tj) {
        Queue<Integer> Q = new LinkedList<Integer>();
        boolean[][] v = new boolean[N][M];
        int[][] prev = new int[N][M];

        Q.add(si); Q.add(sj);
        v[si][sj] = true;
        prev[si][sj] = -1;
        while (!Q.isEmpty()) {
            int pi = Q.remove();
            int pj = Q.remove();

            for (int d = 0; d < 8; d++) {
                int ni = pi + di[d];
                int nj = pj + dj[d];

                if (ni >= 0 && ni < N && nj >= 0 && nj < M && !banned[ni][nj] && !v[ni][nj]) {
                    Q.add(ni); Q.add(nj);
                    v[ni][nj] = true;
                    prev[ni][nj] = pi * M + pj;
                }
            }
        }

        if (!v[ti][tj]) {
            throw new RuntimeException();
        }

        int i = ti;
        int j = tj;
        int cnt = 0;
        while (i != si || j != sj) {
            cnt++;
            int ni = prev[i][j] / M;
            int nj = prev[i][j] % M;
            i = ni;
            j = nj;
        }

        int K = cnt + 1;
        int[][] ret = new int[K][2];
        cnt = K - 1;
        i = ti;
        j = tj;
        while (i != si || j != sj) {
            ret[cnt][0] = i;
            ret[cnt][1] = j;
            int ni = prev[i][j] / M;
            int nj = prev[i][j] % M;
            i = ni;
            j = nj;
            cnt--;
        }
        ret[cnt][0] = si;
        ret[cnt][1] = sj;

        return ret;
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}


import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
    int N;
    int M;
    int[][] A;
    int[][] target;
    boolean[][] banned;
    int ci, cj;
    ArrayList<Integer> moves;

    int[] di = { 0, 1, 0, -1, 1, -1, 1, -1 };
    int[] dj = { 1, 0, -1, 0, 1, -1, -1, 1 };

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        N = in.nextInt();
        M = in.nextInt();
        A = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = in.nextInt();
            }
        }
        target = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                target[i][j] = in.nextInt();
            }
        }

        moves = new ArrayList<Integer>();

        // edge cases
        if (N == 1 || M == 1) {
            handleEdgeCase(out);
            return;
        }

        banned = new boolean[N][M];
        ci = -1;
        cj = -1;
        for (int i = 0; i < N && ci == -1; i++) {
            for (int j = 0; j < M && ci == -1; j++) {
                if (A[i][j] == target[0][0]) {
                    ci = i;
                    cj = j;
                }
            }
        }
        if (ci == -1) {
            out.println(-1);
            return;
        }
        moves.add(ci);
        moves.add(cj);
        for (int i = N - 1; i > 1; i--) {
            for (int j = 0; j < M; j++) {
                if (!placeCell(i, j)) {
                    out.println(-1);
                    return;
                }
            }
        }

        // 2xM
        for (int j = M - 1; j >= 0; j--) {
            for (int i = 1; i >= 0; i--) {
                if (!placeCell(i, j)) {
                    out.println(-1);
                    return;
                }
            }
        }

        out.println(moves.size() / 2 - 1);
        for (int i = 0; i < moves.size(); i += 2) {
            int pi = moves.get(i) + 1;
            int pj = moves.get(i + 1) + 1;
            out.println(pi + " " + pj);
        }
    }

    private void handleEdgeCase(PrintWriter out) {
        boolean rev = false;
        if (M == 1) {
            int[][] B = new int[M][N];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    B[j][i] = A[i][j];
                }
            }
            A = B;

            int[][] BT = new int[M][N];
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    BT[j][i] = target[i][j];
                }
            }
            target = BT;

            rev = true;
            int aux = N; N = M; M = aux;
        }

        boolean ok = false;
        for (int a = 0; a < M && !ok; a++) {
            for (int b = 0; b < M && !ok; b++) {
                if (valid(a, b)) {
                    ok = true;
                }
            }
        }

        if (!ok) {
            out.println(-1);
            return;
        }

        out.println(moves.size() / 2 - 1);
        for (int i = 0; i < moves.size(); i += 2) {
            int pi = moves.get(i) + 1;
            int pj = moves.get(i + 1) + 1;
            if (!rev) {
                out.println(pi + " " + pj);
            }
            else {
                out.println(pj + " " + pi);
            }
        }
    }

    private boolean valid(int a, int b) {
        moves.clear();
        if (a == b) {
            return false;
        }

        int dir = a > b ? -1 : 1;
        int[] start = new int[M];
        for (int i = 0; i < M; i++) {
            start[i] = A[0][i];
        }
        moves.add(0); moves.add(a);
        for (int i = a; i != b; i += dir) {
            int aux = start[i];
            start[i] = start[i + dir];
            start[i + dir] = aux;
            moves.add(0); moves.add(i + dir);
        }

        boolean ok = true;
        for (int i = 0; i < M; i++) {
            if (start[i] != target[0][i]) {
                ok = false;
            }
        }

        return ok;
    }

    private boolean placeCell(int ti, int tj) {
        if (ti == 0 && tj == 0) {
            return true;
        }

        int t = target[ti][tj];
        int pi = -1;
        int pj = -1;
        for (int i = 0; i < N && pi == -1; i++) {
            for (int j = 0; j < M && pi == -1; j++) {
                if (!banned[i][j] && (i != ci || j != cj) && A[i][j] == t) {
                    pi = i;
                    pj = j;
                }
            }
        }

        if (pi == -1) {
            return false;
        }

        int[][] simplePath = computePath(pi, pj, ti, tj);
        for (int p = 1; p < simplePath.length; p++) {
            int previ = simplePath[p - 1][0];
            int prevj = simplePath[p - 1][1];
            int crti = simplePath[p][0];
            int crtj = simplePath[p][1];
            if (ci != previ || cj != prevj) {
                banned[previ][prevj] = true;
                int[][] path = computePath(ci, cj, crti, crtj);
                executeMoves(path);
                banned[previ][prevj] = false;
                int aux = A[ci][cj];
                A[ci][cj] = A[previ][prevj];
                A[previ][prevj] = aux;
                ci = previ;
                cj = prevj;
                moves.add(ci);
                moves.add(cj);
            }
            else {
                int aux = A[ci][cj];
                A[ci][cj] = A[crti][crtj];
                A[crti][crtj] = aux;
                ci = crti;
                cj = crtj;
                moves.add(ci);
                moves.add(cj);
            }
        }

        banned[ti][tj] = true;
        return true;
    }

    private void executeMoves(int[][] path) {
        if (ci != path[0][0] || cj != path[0][1]) {
            throw new RuntimeException();
        }

        int K = path.length;
        for (int m = 0; m < K - 1; m++) {
            int crti = path[m][0];
            int crtj = path[m][1];
            int nexti = path[m + 1][0];
            int nextj = path[m + 1][1];
            int aux = A[crti][crtj];
            A[crti][crtj] = A[nexti][nextj];
            A[nexti][nextj] = aux;
            moves.add(nexti);
            moves.add(nextj);
        }

        ci = path[K - 1][0];
        cj = path[K - 1][1];
    }

    private int[][] computePath(int si, int sj, int ti, int tj) {
        Queue<Integer> Q = new LinkedList<Integer>();
        boolean[][] v = new boolean[N][M];
        int[][] prev = new int[N][M];

        Q.add(si); Q.add(sj);
        v[si][sj] = true;
        prev[si][sj] = -1;
        while (!Q.isEmpty()) {
            int pi = Q.remove();
            int pj = Q.remove();

            for (int d = 0; d < 8; d++) {
                int ni = pi + di[d];
                int nj = pj + dj[d];

                if (ni >= 0 && ni < N && nj >= 0 && nj < M && !banned[ni][nj] && !v[ni][nj]) {
                    Q.add(ni); Q.add(nj);
                    v[ni][nj] = true;
                    prev[ni][nj] = pi * M + pj;
                }
            }
        }

        if (!v[ti][tj]) {
            throw new RuntimeException();
        }

        int i = ti;
        int j = tj;
        int cnt = 0;
        while (i != si || j != sj) {
            cnt++;
            int ni = prev[i][j] / M;
            int nj = prev[i][j] % M;
            i = ni;
            j = nj;
        }

        int K = cnt + 1;
        int[][] ret = new int[K][2];
        cnt = K - 1;
        i = ti;
        j = tj;
        while (i != si || j != sj) {
            ret[cnt][0] = i;
            ret[cnt][1] = j;
            int ni = prev[i][j] / M;
            int nj = prev[i][j] % M;
            i = ni;
            j = nj;
            cnt--;
        }
        ret[cnt][0] = si;
        ret[cnt][1] = sj;

        return ret;
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define all(c) (c).begin(),(c).end()
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define vvpi vector<vector<pair<int,int> > >
#define Inp(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define Out(a,n,ch) for(int i=0;i<n;i++)cout<<a[i]<<ch;cout<<endl;

int a[300005],dp[1050005][2];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n,ans=0;
	cin>>n;
	vi x;
	map <int,int> last;
	for(int i=0;i<n;i++)
		cin>>a[i];
	x.pb(0);
	for(int i=1;i<=n;i++)
	{
		x.pb(x[i-1]^a[i-1]);
	}
	//Out(x,n+1,' ');

	for(int i=0;i<=n;i++)
		last[x[i]]=-1;
	for(int i=0;i<=n;i++)
	{
		if(last[x[i]]==-1)
		{
			last[x[i]]=i;
			dp[x[i]][0]=0;
			dp[x[i]][1]=0;
			continue;
		}
		if((i-last[x[i]])%2==0)
		{
			dp[x[i]][0] += 1;
			dp[x[i]][1] = dp[x[i]][1];
		}
		else
		{
			dp[x[i]][0] = dp[x[i]][1];
			dp[x[i]][1] = 1+dp[x[i]][0];
		}
		ans += dp[x[i]][0];
		//cout<<i<<" "<<ans<<endl;
		last[x[i]]=i;
	}
	cout<<ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define all(c) (c).begin(),(c).end()
#define ss second
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define vvpi vector<vector<pair<int,int> > >
#define Inp(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define Out(a,n,ch) for(int i=0;i<n;i++)cout<<a[i]<<ch;cout<<endl;

int a[300005],dp[2100005][2];

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n,ans=0;
	cin>>n;
	vi x;
	map <int,int> last;
	for(int i=0;i<n;i++)
		cin>>a[i];
	x.pb(0);
	for(int i=1;i<=n;i++)
	{
		x.pb(x[i-1]^a[i-1]);
	}
	//Out(x,n+1,' ');

	for(int i=0;i<=n;i++)
	{
		if(i%2==0)
		{
			ans += dp[x[i]][0];
			dp[x[i]][0]++;
		}
		else
		{
			ans += dp[x[i]][1];
			dp[x[i]][1]++;
		}
		//cout<<i<<" "<<ans<<endl;
	}
	cout<<ans;

	return 0;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
int v[100001],impar[2100001],par[2100001];
main ()
{
    int n,a,t;
    cin>>n>>a;
    t=a;
    impar[a]++;
    for (int i = 2;i <= n; ++i)
    {
        cin>>a;
        t^=a;
        if (i%2==1)
            impar[t]++;
        else
            par[t]++;
    }
    int sol = 0;
    par[0]++;
    for (int i = 0; i<=2100000; ++i)
        sol+=(par[i]*par[i]-1)/2+(impar[i]*\impar[i]-1)/2;
    cout<<sol;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
int v[100001],impar[2100001],par[2100001];
main ()
{
    int n,a,t;
    cin>>n>>a;
    t=a;
    impar[a]++;
    for (int i = 2;i <= n; ++i)
    {
        cin>>a;
        t^=a;
        if (i%2==1)
            impar[t]++;
        else
            par[t]++;
    }
    int sol = 0;
    par[0]++;
    for (int i = 0; i<=2100000; ++i)
    {
        sol+=(par[i]*par[i]-1)/2+(impar[i]+impar[i]-1)/2;
    }
    cout<<sol;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
int v[100001],impar[2100001],par[2100001];
main ()
{
    int n,a,t;
    cin>>n>>a;
    t=a;
    impar[a]++;
    for (int i = 2;i <= n; ++i)
    {
        cin>>a;
        t^=a;
        if (i%2==1)
            impar[t]++;
        else
            par[t]++;
    }
    int sol = 0;
    par[0]++;
    for (int i = 0; i<=2100000; ++i)
        sol+=(par[i]*(par[i]-1))/2+(impar[i]*(impar[i]-1))/2;
    cout<<sol;
}


#include <bits/stdc++.h>
#define int long long
using namespace std;
int v[100001],impar[2100001],par[2100001];
main ()
{
    int n,a,t;
    cin>>n>>a;
    t=a;
    impar[a]++;
    for (int i = 2;i <= n; ++i)
    {
        cin>>a;
        t^=a;
        if (i%2==1)
            impar[t]++;
        else
            par[t]++;
    }
    int sol = 0;
    par[0]++;
    for (int i = 0; i<=2100000; ++i)
        sol+=(par[i]*par[i]-1)/2+(impar[i]*impar[i]-1)/2;
    cout<<sol;
}


#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//namespace mp = boost :: multiprecision;
//#define lint mp ::cpp_int
using namespace std;
#define int long long int
#define MOD 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
//inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}
/*vector<int>pr;
vector<int>a(19990000,1);
void sieve(int nn){//895037185073
for(int i=2;i<=nn;i++){
  if (a[i]==1) { pr.pb(i);
    for (int j = 2; j * i <= nn; j ++) a[i * j] = 0;
  }
}

}*/
//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */

signed main()
{
 fio;
int n;
cin>>n;
vector<int>v(n),s(n+1);
for(auto &i:v) cin>>i;
s[0]=0;
for(int i=1;i<=n;i++)
s[i]=s[i-1]^v[i-1];
//print(s)
vector<pair<int,int>>a(200003,{0,0});
for(int i=0;i<=n;i++)
{
    if( i%2==0 ){//even
    a[s[i]].fr++;
    }
    else{
    a[s[i]].sc++;
    }
}
int ans=0;
for(int i=0;i<200003;i++){
    if(a[i].fr || a[i].sc){
        int u=a[i].fr,x=a[i].sc;
        ans+=(((u)*(u-1))/2);
        ans+=(((x)*(x-1))/2);
    }

}

cout<<ans;
return 0;
}


#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//namespace mp = boost :: multiprecision;
//#define lint mp ::cpp_int
using namespace std;
#define int long long int
#define MOD 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
//inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}
/*vector<int>pr;
vector<int>a(19990000,1);
void sieve(int nn){//895037185073
for(int i=2;i<=nn;i++){
  if (a[i]==1) { pr.pb(i);
    for (int j = 2; j * i <= nn; j ++) a[i * j] = 0;
  }
}

}*/
//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */

signed main()
{
// fio;
int n;
cin>>n;
vector<int>v(n),s(n+1);
for(auto &i:v) cin>>i;
s[0]=0;
for(int i=1;i<=n;i++)
s[i]=s[i-1]^v[i-1];
//print(s)
vector<pair<int,int>>a(2000003,{0,0});
for(int i=0;i<=n;i++)
{
    if( i%2==0 ){//even
    a[s[i]].fr++;
    }
    else{
    a[s[i]].sc++;
    }
}
int ans=0;
for(int i=0;i<2000003;i++){
    if(a[i].fr || a[i].sc){
        int u=a[i].fr,x=a[i].sc;
        ans+=(((u)*(u-1))/2);
        ans+=(((x)*(x-1))/2);
    }

}

cout<<ans;
return 0;
}


#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//namespace mp = boost :: multiprecision;
//#define lint mp ::cpp_int
using namespace std;
#define int long long int
#define MOD 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
//inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}
/*vector<int>pr;
vector<int>a(19990000,1);
void sieve(int nn){//895037185073
for(int i=2;i<=nn;i++){
  if (a[i]==1) { pr.pb(i);
    for (int j = 2; j * i <= nn; j ++) a[i * j] = 0;
  }
}

}*/
//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */

signed main()
{
 fio;
int n;
cin>>n;
vector<int>v(n),s(n+1);
for(auto &i:v) cin>>i;
s[0]=0;
for(int i=1;i<=n;i++)
s[i]=s[i-1]^v[i-1];
//print(s)
vector<pair<int,int>>a(2000003,{0,0});
for(int i=0;i<=n;i++)
{
    if( i%2==0 ){//even
    a[s[i]].fr++;
    }
    else{
    a[s[i]].sc++;
    }
}
int ans=0;
for(int i=0;i<2000003;i++){
    if(a[i].fr || a[i].sc){
        int u=a[i].fr,x=a[i].sc;
        ans+=(((u)*(u-1))/2);
        ans+=(((x)*(x-1))/2);
    }

}

cout<<ans;
return 0;
}


#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//namespace mp = boost :: multiprecision;
//#define lint mp ::cpp_int
using namespace std;
#define int long long int
#define MOD 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
//inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}
/*vector<int>pr;
vector<int>a(19990000,1);
void sieve(int nn){//895037185073
for(int i=2;i<=nn;i++){
  if (a[i]==1) { pr.pb(i);
    for (int j = 2; j * i <= nn; j ++) a[i * j] = 0;
  }
}

}*/
//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */

signed main()
{
 fio;
int n;
cin>>n;
vector<int>v(n),s(n+1);
for(auto &i:v) cin>>i;
s[0]=0;
for(int i=1;i<=n;i++)
s[i]=s[i-1]^v[i-1];
vector<pair<int,int>>a(200003,{0,0});
for(int i=0;i<=n;i++)
{
    if( i%2==0 ){//even
    a[s[i]].fr++;
    }
    else{
    a[s[i]].sc++;
    }
}
int ans=0;
for(int i=0;i<200003;i++){
    if(a[i].fr || a[i].sc){
        int u=a[i].fr,x=a[i].sc;
        ans+=((u/2)*(u-1));
        ans+=((x/2)*(x-1));
    }

}

cout<<ans;
return 0;
}


#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//namespace mp = boost :: multiprecision;
//#define lint mp ::cpp_int
using namespace std;
#define int long long int
#define MOD 1000000007
#define db(x) cout<<#x<<' '<<x<<endl;
#define float double
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fr first
#define sc second
#define prmap(p) for(auto k:p) cout<<k.fr<<' '<<k.sc<<endl;
#define prset(x) for(auto it=x.begin();it!=x.end();it++) cout<< *it<<' ';cout<<endl
#define all(x) x.begin(),x.end()
#define print(v) for(auto i:v) cout<<i<<' ';cout<<endl;
int min (int x,int y) {if(x<y) return x;return y;}
//inline bool is_palindrome(const string &s) { return std::equal(s.begin(), s.end(), s.rbegin());}
/*vector<int>pr;
vector<int>a(19990000,1);
void sieve(int nn){//895037185073
for(int i=2;i<=nn;i++){
  if (a[i]==1) { pr.pb(i);
    for (int j = 2; j * i <= nn; j ++) a[i * j] = 0;
  }
}

}*/
//int maxx(int a,int b) {if(a>b) return a;return b;}
/*int nCr(int n, int r)
{   int p = 1, k = 1;
    if (n - r < r)     r = n - r;
  if (r != 0) {
        while (r) {
            p *= n;
            k *= r; long long m = __gcd(p, k); p /= m;k /= m; n--; r--;
        }
    } else p = 1;

    return p;
} */

signed main()
{
 fio;
int n;
cin>>n;
vector<int>v(n),s(n+1);
for(auto &i:v) cin>>i;
s[0]=0;
for(int i=1;i<=n;i++)
s[i]=s[i-1]^v[i-1];
vector<pair<int,int>>a(2000003,{0,0});
for(int i=0;i<=n;i++)
{
    if( i%2==0 ){//even
    a[s[i]].fr++;
    }
    else{
    a[s[i]].sc++;
    }
}
int ans=0;
for(int i=0;i<2000003;i++){
    if(a[i].fr || a[i].sc){
        int u=a[i].fr,x=a[i].sc;
        ans+=((u/2)*(u-1));
        ans+=((x/2)*(x-1));
    }

}

cout<<ans;
return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	ll inp[n];
	ll vals[n+1] = {0};
	for(int i=0;i<n;i++){
		cin>>inp[i];
		vals[i+1] = vals[i]^inp[i];
//		cout<<"vals:"<<vals[i+1]<<endl;
	}
	ll res=0;
	ll val = 0;
	map<ll,ll> dp[2];
	dp[1][0] = 0;
	dp[0][0] = 1;
	for(ll i=1;i<=n;i++){
		val = val ^ vals[i];
		res += dp[i%2][vals[i]];
		dp[i%2][vals[i]]++;
//		cout<<"val:"<<val<<endl;
	}
	cout<<res<<endl;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int a[n+1], dp[n+1] = {0};
	for(int i=1;i<n+1;i++){
		cin>>a[i];
		dp[i] = dp[i-1] ^ a[i];
	}

	int count = 0;
	for(int i=1;i<n;i++) {	// for l
		for(int j=i+1;j<=n;j+=2) {
			if(j==i+1)
				if(a[i]==a[j]) {
					count++;
					continue;
				}
			int mid = (j-i+1) / 2;
			if(dp[mid] ^ dp[i-1] == dp[j] ^ dp[mid])	count++;
		}
	}
	cout<<count<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int inp[n];
	int vals[n+1] = {0};
	for(int i=0;i<n;i++){
		cin>>inp[i];
		vals[i+1] = vals[i]^inp[i];
//		cout<<"vals:"<<vals[i+1]<<endl;
	}
	int res=0;
	int val = 0;
	map<int,int> dp[2];
	dp[1][0] = 0;
	dp[0][0] = 1;
	for(int i=1;i<=n;i++){
		val = val ^ vals[i];
		res += dp[i%2][vals[i]];
		dp[i%2][vals[i]]++;
//		cout<<"val:"<<val<<endl;
	}
	cout<<res<<endl;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	int a[n+1], dp[n+1] = {0};
	for(int i=1;i<n+1;i++){
		cin>>a[i];
		dp[i] = dp[i-1] ^ a[i];
	}

	int count = 0;
	for(int i=1;i<n;i++) {	// for l
		for(int j=i;j<=n;j++) {
			if(((j-i+1) & 1) == 0) {	// is even
				int mid = (j-i+1) / 2;
				if(dp[mid] ^ dp[i-1] == dp[j] ^ dp[mid])	count++;
			}
		}
	}
	cout<<count<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[7000009][4];
long long  p[1000009];
int main()
{
    long long  n;
    cin>>n;
    for(int i=0;i<n;i++)
        scanf("%d",p+i);
    long long  ans=0;
    dp[0][1]=1;
    long long  ch=0;
    for(int i=0;i<n;i++)
    {
        ch=p[i]^ch;
        ans+=dp[ch][i%2];
        dp[ch][i%2]++;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[7000009][4];
long long  p[1000009];
int main()
{
    long long  n;
    cin>>n;
    for(int i=0;i<n;i++)
        scanf("%d",p+i);
    int ans=0;
    dp[0][1]=1;
    long long  ch=0;
    for(int i=0;i<n;i++)
    {
        ch=p[i]^ch;
        ans+=dp[ch][i%2];
        dp[ch][i%2]++;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
long long dp[7000009][4];
long long  p[7000009];
int main()
{
    long long  n;
    cin>>n;
    for(int i=0;i<n;i++)
        scanf("%d",p+i);
    int ans=0;
    dp[0][1]=1;
    long long  ch=0;
    for(int i=0;i<n;i++)
    {
        ch=p[i]^ch;
        ans+=dp[ch][i%2];
        dp[ch][i%2]++;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int dp[7000009][4];
int main()
{
    int n;
    cin>>n;
    int *p=new int[n];
    for(int i=0;i<n;i++)
        scanf("%d",p+i);
    int ans=0;
    dp[0][1]=1;
    long long  ch=0;
    for(int i=0;i<n;i++)
    {
        ch=p[i]^ch;
        ans+=dp[ch][i%2];
        dp[ch][i%2]++;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int dp[7000009][4];
int main()
{
    int n;
    cin>>n;
    int *p=new int[n];
    for(int i=0;i<n;i++)
        scanf("%d",p+i);
    int ans=0;
    dp[0][1]=1;
    int ch=0;
    for(int i=0;i<n;i++)
    {
        ch=p[i]^ch;
        ans+=dp[ch][i%2];
        dp[ch][i%2]++;
    }
    cout<<ans<<endl;
}


//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g $PROGRAM -o $OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin >> n;
	vector<ll> arr(n + 1);
	vector<ll> pref(n + 1, 0);
	map<ll, vector<ll>> ste,sto;
	for (ll i = 1; i <= n;++i)
	{
		cin >> arr[i];
		pref[i] = pref[i - 1] ^ arr[i];
		if(i%2==0)
		ste[pref[i]].pb(i);
		else
			sto[pref[i]].pb(i);
	}

	int ans = 0;
	for (int i = 1; i <= n;++i)
	{
		if(i%2==0)
		{
			auto it = lower_bound(all(sto[pref[i - 1]]), i);
			ans += (sto[pref[i - 1]].end() - it);
		}
		else{
			auto it = lower_bound(all(ste[pref[i - 1]]), i);
			ans += (ste[pref[i - 1]].end() - it);
		}

		//cout << endl;
	}

	cout << ans;

#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}


//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g $PROGRAM -o $OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin >> n;
	vector<ll> arr(n + 1);
	vector<ll> pref(n + 1, 0);
	for (ll i = 1; i <= n;++i)
	{
		cin >> arr[i];
		pref[i] = pref[i - 1] ^ arr[i];
	}

	int ans = 0;
	for (int i = 1; i <= n;++i)
	{
		for (int j = i + 1; j <= n;j+=2)
		{
			int mid = (j + i - 1) / 2;
			if((ll)(pref[i-1]^pref[mid])==(ll)(pref[mid]^pref[j]))
				ans++;
			//cout << (ll)(pref[i-1] ^ pref[j]) << ' ';
		}
		//cout << endl;
	}

	cout << ans;

#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}


//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g $PROGRAM -o $OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin >> n;
	vector<ll> arr(n + 1);
	vector<ll> pref(n + 1, 0);
	map<ll, vector<ll>> st;
	for (ll i = 1; i <= n;++i)
	{
		cin >> arr[i];
		pref[i] = pref[i - 1] ^ arr[i];
		st[pref[i]].pb(i);
	}

	int ans = 0;
	for (int i = 1; i <= n;++i)
	{
		auto it = upper_bound(all(st[pref[i - 1]]), i);
		while(it!=st[pref[i-1]].end())
		{
			if((*it+i-1)%2==0)
				ans++;
			it++;
		}
		//cout << endl;
	}

	cout << ans;

#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}


//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g $PROGRAM -o $OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define alli(a, n, k) (a + k), (a + n + k)
#define FP(i, a, b, k) for (__typeof(a) i = a; i < b; i += k)
#define FS(i, a, b, k) for (__typeof(a) i = a; i > b; i -= k)
#define IT(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;
using namespace __gnu_pbds;

template <class T>
inline T gcd(T x, T y)
{
	if (!y)
		return x;
	return gcd(y, x % y);
}
typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;

inline ll modulo(ll a, ll m)
{
	return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
	assert(__gcd(a, m) == 1);
	ll m0 = m;
	ll y = 0, x = 1;

	if (m == 1)
		return 0;

	while (a > 1)
	{
		ll q = a / m;
		ll t = m;

		m = a % m, a = t;
		t = y;

		y = x - q * y;
		x = t;
	}

	if (x < 0)
		x += m0;

	return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
	if (y == 0)
		return 1LL;
	else if (y == 1)
		return x;
	else
	{
		ll ans = modPow(x, y / 2, m) % m;
		if (y & 1)
		{
			return (((ans * ans) % m) * x) % m;
		}
		else
		{
			return (ans * ans) % m;
		}
	}
}

vector<string> split(char d,string s)
{
	stringstream ss(s);
	string t;
	vector<string> words;
	while(getline(ss,t,d))
	{
		words.pb(t);
	}

	return words;
}

int main(int argc, char *argv[])
{
#ifdef LOCAL
	auto start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	ll n;
	cin >> n;
	vector<ll> arr(n + 1);
	vector<ll> pref(n + 1, 0);
	unordered_map<ll, vector<ll>> ste,sto;
	for (ll i = 1; i <= n;++i)
	{
		cin >> arr[i];
		pref[i] = pref[i - 1] ^ arr[i];
		if(i%2==0)
		ste[pref[i]].pb(i);
		else
			sto[pref[i]].pb(i);
	}

	ll ans = 0;
	for (int i = 1; i <= n;++i)
	{
		if(i%2==0)
		{
			auto it = lower_bound(all(sto[pref[i - 1]]), i);
			ans += (sto[pref[i - 1]].end() - it);
		}
		else{
			auto it = lower_bound(all(ste[pref[i - 1]]), i);
			ans += (ste[pref[i - 1]].end() - it);
		}

		//cout << endl;
	}

	cout << ans;

#ifdef LOCAL
	auto end = chrono::high_resolution_clock::now();
	double time_taken =
		chrono::duration_cast<chrono::nanoseconds>(end - start).count();

	time_taken *= 1e-9;

	cerr << "\nTime taken by program is : " << fixed
		 << time_taken << setprecision(9);
	cerr << " sec" << endl;
#endif
	return 0;
}


#include<bits/stdc++.h>
#define ll int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define vdp(n,x) vector<vector<ll>>dp(n+1,vector<ll>(x+1));
const ll mod=1000000007;
const ll AM=2e5+5;
using namespace std;
ll ma=1<<20+3;
vdp(2,ma);
int32_t main()
{
    fast;
    ll n; cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++) cin>>a[i];
    vector<ll>pre(n+1); pre[0]=0;
	for(ll i=1;i<=n;i++)
		pre[i]=pre[i-1]^a[i];

	int64_t ans=0;
	for(ll i=0;i<=n;i++)
	{
		ans+=dp[i%2][pre[i]];
		dp[i%2][pre[i]]++;
		//cout<<dp[i%2][pre[i]]<<" ";
		//cout<<ans<<endl;
	}
	cout<<ans;
}


#include<bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define vdp(n,x) vector<vector<ll>>dp(n+1,vector<ll>(x+1));
const ll mod=1000000007;
const ll AM=2e5+5;
using namespace std;
int main()
{
    fast;
    ll n; cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++) cin>>a[i];
    vector<ll>pre(n+1); pre[0]=0;
	for(ll i=1;i<=n;i++)
		pre[i]=pre[i-1]^a[i];
	ll ma=1<<20+3;
	vdp(2,ma);
	ll ans=0;
	for(ll i=0;i<=n;i++)
	{
		ans+=dp[i%2][pre[i]];
		dp[i%2][pre[i]]++;
		//cout<<dp[i%2][pre[i]]<<" ";
		//cout<<ans<<endl;
	}
	cout<<ans;
}


#include<bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define vdp(n,x) vector<vector<ll>>dp(n+1,vector<ll>(x+1));
const ll mod=1000000007;
const ll AM=2e5+5;
using namespace std;
ll ma=1<<20+3;
vdp(2,ma);
int main()
{
    fast;
    ll n; cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++) cin>>a[i];
    vector<ll>pre(n+1); pre[0]=0;
	for(ll i=1;i<=n;i++)
		pre[i]=pre[i-1]^a[i];

	ll ans=0;
	for(ll i=0;i<=n;i++)
	{
		ans+=dp[i%2][pre[i]];
		dp[i%2][pre[i]]++;
		//cout<<dp[i%2][pre[i]]<<" ";
		//cout<<ans<<endl;
	}
	cout<<ans;
}


#include<bits/stdc++.h>
#define ll int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define fo(i, x, y)   for (__typeof(x) i = x; i < y; ++i)
#define fr(i, x, y)   for (__typeof(x) i = x; i > y; i--)
#define vdp(n,x) vector<vector<ll>>dp(n+1,vector<ll>(x+1));
const ll mod=1000000007;
const ll AM=2e5+5;
using namespace std;
ll ma=1<<20+3;
vdp(2,ma);
int main()
{
    fast;
    ll n; cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++) cin>>a[i];
    vector<ll>pre(n+1); pre[0]=0;
	for(ll i=1;i<=n;i++)
		pre[i]=pre[i-1]^a[i];

	ll ans=0;
	for(ll i=0;i<=n;i++)
	{
		ans+=dp[i%2][pre[i]];
		dp[i%2][pre[i]]++;
		//cout<<dp[i%2][pre[i]]<<" ";
		//cout<<ans<<endl;
	}
	cout<<ans;
}


        #include <bits/stdc++.h>

        #define endl "\n"
        using namespace std;
        using ll = long long;
        using ld = long double;
        using pii = pair<int, int>;

        constexpr ll INF = 1e18;

        int main()
        {
            //freopen("input.txt","r",stdin);
            //freopen("output.txt","w",stdout);
            ios::sync_with_stdio(false);
            cin.tie(nullptr);
            cout.tie(nullptr);

            for(int i = 0; i < 5; i += 5){
                int a = 0;
            }

            int n;
            cin >> n;
            vector<int> arr(n);
            vector<int> xors(n);
            cin >> arr[0];
            xors[0] = arr[0];
            for(int i = 1; i < n; i++){
                cin >> arr[i];
                xors[i] = xors[i-1] ^ arr[i];
            }
            int count = 0;
            for(int i = 0; i < n; i++){
                for(int j = i+1; j < n; j += 2){
                    if((i ? xors[i-1] : 0) == xors[j]) count++;
                }
            }
            cout << count;

            return 0;
        }


        #include <bits/stdc++.h>

        #define endl "\n"
        using namespace std;
        using ll = long long;
        using ld = long double;
        using pii = pair<int, int>;

        constexpr ll INF = 1e18;

        int main()
        {
            //freopen("input.txt","r",stdin);
            //freopen("output.txt","w",stdout);
            ios::sync_with_stdio(false);
            cin.tie(nullptr);
            cout.tie(nullptr);

            ll n;
            cin >> n;
            vector<ll> arr(n), pre(n);
            for(ll i = 0; i < n; i++){
                cin >> arr[i];
                pre[i] = (i ? pre[i-1] ^ arr[i] : arr[i]);
            }
            map<ll,ll> chet, nechet;
            ll count = 0;

            chet[0] = 1;
            for(ll i = 0; i < n; i++){
                if(i%2){
                    if(chet.find(pre[i]) != chet.end()){
                        count += chet[pre[i]];
                        chet[pre[i]]++;
                    }
                    else chet[pre[i]] = 1;
                }
                else{
                    if(nechet.find(pre[i]) != nechet.end()){
                        count += nechet[pre[i]];
                        nechet[pre[i]]++;
                    }
                    else nechet[pre[i]] = 1;
                }
            }
            cout << count;

            return 0;
        }


    #include <bits/stdc++.h>

    #define endl "\n"
    using namespace std;
    using ll = long long;
    using ld = long double;
    using pii = pair<int, int>;

    constexpr ll INF = 1e18;

    int main()
    {
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);

        for(int i = 0; i < 5; i += 5){
            int a = 0;
        }

        int n;
        cin >> n;
        vector<int> arr(n);
        vector<int> xors(n);
        cin >> arr[0];
        xors[0] = arr[0];
        for(int i = 1; i < n; i++){
            cin >> arr[i];
            xors[i] = xors[i-1] ^ arr[i];
        }
        int count = 0, mid = 0;
        for(int i = 0; i < n; i++){
            for(int j = i+1; j < n; j += 2){
                mid = (j+i-1)/2;
                if(xors[mid]^((i == 0) ? 0 : xors[i-1]) == xors[j]^xors[mid]){
                    count++;
                }
            }
        }
        cout << count;

        return 0;
    }


        #include <bits/stdc++.h>

        #define endl "\n"
        using namespace std;
        using ll = long long;
        using ld = long double;
        using pii = pair<int, int>;

        constexpr ll INF = 1e18;

        int main()
        {
            //freopen("input.txt","r",stdin);
            //freopen("output.txt","w",stdout);
            ios::sync_with_stdio(false);
            cin.tie(nullptr);
            cout.tie(nullptr);

            int n;
            cin >> n;
            vector<int> arr(n), pre(n);
            for(int i = 0; i < n; i++){
                cin >> arr[i];
                pre[i] = (i ? pre[i-1] ^ arr[i] : arr[i]);
            }
            map<int,int> chet, nechet;
            int count = 0;

            chet[0] = 1;
            for(int i = 0; i < n; i++){
                if(i%2){
                    if(chet.find(pre[i]) != chet.end()){
                        count += chet[pre[i]];
                        chet[pre[i]]++;
                    }
                    chet[pre[i]] = 1;
                }
                else{
                    if(nechet.find(pre[i]) != nechet.end()){
                        count += nechet[pre[i]];
                        nechet[pre[i]]++;
                    }
                    nechet[pre[i]] = 1;
                }
            }
            cout << count;

            return 0;
        }


        #include <bits/stdc++.h>

        #define endl "\n"
        using namespace std;
        using ll = long long;
        using ld = long double;
        using pii = pair<int, int>;

        constexpr ll INF = 1e18;

        int main()
        {
            //freopen("input.txt","r",stdin);
            //freopen("output.txt","w",stdout);
            ios::sync_with_stdio(false);
            cin.tie(nullptr);
            cout.tie(nullptr);

            int n;
            cin >> n;
            vector<int> arr(n), pre(n);
            for(int i = 0; i < n; i++){
                cin >> arr[i];
                pre[i] = (i ? pre[i-1] ^ arr[i] : arr[i]);
            }
            map<int,int> chet, nechet;
            int count = 0;

            chet[0] = 1;
            for(int i = 0; i < n; i++){
                if(i%2){
                    if(chet.find(pre[i]) != chet.end()){
                        count += chet[pre[i]];
                        chet[pre[i]]++;
                    }
                    else chet[pre[i]] = 1;
                }
                else{
                    if(nechet.find(pre[i]) != nechet.end()){
                        count += nechet[pre[i]];
                        nechet[pre[i]]++;
                    }
                    else nechet[pre[i]] = 1;
                }
            }
            cout << count;

            return 0;
        }


//Keep Working hard
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);

const int N = 3e5+5;
int a[N];
const int lol = 1<<20+5;
int cnt[2][lol];

void solve()
{
    int n;
    cin >> n;
    for(int i = 0; i <n; i++)cin >> a[i];
    cnt[1][0] = 1;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        ans += cnt[i%2][x];
        ans += cnt;
        ++cnt[i%2][x];
    }
    cout << ans;
}

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}

int32_t main()
{
    IOS;
    fileIO();
    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


//Keep Working hard
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);

const int N = 3e5+5;
int a[N];
int count[2][1<<20+20];
void solve()
{
    int n;
    cin >> n;
    for(int i = 0; i <n; i++)cin >> a[i];
    count[1][0] = 1;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        ans += count[i%2][x];
        ans += count;
        ++count[i%2][x];
    }
    cout << ans;
}

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}

int32_t main()
{
    IOS;
    fileIO();
    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


//Keep Working hard
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);

const int N = 3e5+5;
int a[N];
const int lol = (1<<20)+5;
int cnt[2][lol];

void solve()
{
    int n;
    cin >> n;
    for(int i = 0; i <n; i++)cin >> a[i];
    cnt[1][0] = 1;
    int ans = 0,x=0;
    for(int i = 0; i < n; i++)
    {
        x ^= a[i];
        ans += cnt[i%2][x];
        ++cnt[i%2][x];
    }
    cout << ans;
}

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}

int32_t main()
{
    IOS;
    fileIO();
    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


//Keep Working hard
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);

const int N = 3e5+5;
int a[N];
const int lol = 1<<20+5;
int cnt[2][lol];

void solve()
{
    int n;
    cin >> n;
    for(int i = 0; i <n; i++)cin >> a[i];
    cnt[1][0] = 1;
    int ans = 0,x=0;
    for(int i = 0; i < n; i++)
    {
        x ^= a[i];
        ans += cnt[i%2][x];
        ++cnt[i%2][x];
    }
    cout << ans;
}

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}

int32_t main()
{
    IOS;
    fileIO();
    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl '\n'
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,j,ans=0;
    cin>>n;
    vector<ll> a(n);
    forn(i,n) cin>>a[i];
    map<ll,ll> m,mm;
    ll x=0;
    m[0]=-1;
    forn(i,n)
    {
        x^=a[i];
        if(m.find(x)!=m.end())
        {
            // cout<<i+1<<" "<<m[x]<<endl;
            if((i-m[x])%2==0)
            ans+=++mm[x];
        }
        m[x]=i;
    }
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        JAISHREERAM();
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl '\n'
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,j,ans=0;
    cin>>n;
    vector<ll> a(n);
    forn(i,n) cin>>a[i];
    map<ll,vector<ll> > m;
    ll x=0;
    m[0].pb(-1);
    forn(i,n)
    {
        x^=a[i];
        if(m[x].size()!=0)
        {
            // cout<<i+1<<" "<<m[x]<<endl;
            for(auto t:m[x])
            if((i-t)%2==0)
            ans++;
        }
        m[x].pb(i);
    }
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        JAISHREERAM();
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl '\n'
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,j,ans=0;
    cin>>n;
    vector<ll> a(n);
    forn(i,n) cin>>a[i];
    map<ll,pair<ll,ll> > m,mm;
    ll x=0;
    m[0]={0,1};
    forn(i,n)
    {
        x^=a[i];
        if(m.find(x)!=m.end())
        {
            if(i%2) ans+=m[x].second;
            else ans+=m[x].first;
        }
        if(i%2) m[x].second++;
        else m[x].first++;
    }
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        JAISHREERAM();
    }
    return 0;
}


#include<bits/stdc++.h>
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl '\n'
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 100001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,j,ans=0;
    cin>>n;
    vector<ll> a(n);
    forn(i,n) cin>>a[i];
    map<ll,ll> m;
    ll x=0;
    m[0]=0;
    forn(i,n)
    {
        x^=a[i];
        if(m.find(x)!=m.end())
        {
            // cout<<i+1<<" "<<m[x]<<endl;
            if((i+1-m[x])%2==0)
            ans++;
        }
        m[x]=i+1;
    }
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    fast;
    int T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        JAISHREERAM();
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;

template <class T>
bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int dp[(1 << 20) + 10][2];
int N;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dp[0][0] = 0;
	int xor_upto = 0, cur, ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> cur;
		xor_upto ^= cur;
		ans += dp[xor_upto][i & 1];
		++dp[xor_upto][i & 1];
	}
	cout << ans << '\n';
}


#include "bits/stdc++.h"
using namespace std;

template <class T>
bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int dp[(1 << 20) + 10][2];
int N;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	int xor_upto = 0, cur, ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> cur;
		xor_upto ^= cur;
		ans += dp[xor_upto][i & 1];
		++dp[xor_upto][i & 1];
	}
	cout << ans << '\n';
}


#include "bits/stdc++.h"
using namespace std;

template <class T>
bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int dp[(1 << 20) + 10][2];
int N;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dp[0][1] = 1;
	int xor_upto = 0, cur, ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> cur;
		xor_upto ^= cur;
		ans += dp[xor_upto][i & 1];
		++dp[xor_upto][i & 1];
	}
	cout << ans << '\n';
}


#include "bits/stdc++.h"
using namespace std;

template <class T>
bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int dp[(1 << 20) + 10][2];
int N;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dp[0][0] = 1;
	int xor_upto = 0, cur, ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> cur;
		xor_upto ^= cur;
		ans += dp[xor_upto][i & 1];
		++dp[xor_upto][i & 1];
	}
	cout << ans << '\n';
}


#include "bits/stdc++.h"
using namespace std;

template <class T>
bool uin(T& a, T b) { return a > b ? (a = b, true) : false; }
template <class T>
bool uax(T& a, T b) { return a < b ? (a = b, true) : false; }

int dp[(1 << 20) + 10][2];
int N;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dp[0][1] = 1;
	int xor_upto = 0, cur;
	long long ans = 0;
	for (int i = 0; i < N; ++i) {
		cin >> cur;
		xor_upto ^= cur;
		ans += dp[xor_upto][i & 1];
		++dp[xor_upto][i & 1];
	}
	cout << ans << '\n';
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll maxi=(1<<20)+3;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    int dp[2][maxi];
    dp[1][0]=1;
    ll res=0;
    int x=0;
    for(int i=0;i<n;i++)
    {
        x^=ar[i];
        res+=dp[i%2][x];
        ++dp[i%2][x];
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int maxi=100005;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    int dp[2][maxi];
    dp[1][0]=1;
    ll res=0;
    int x=0;
    for(int i=0;i<n;i++)
    {
        x^=ar[i];
        res+=dp[i%2][x];
        ++dp[i%2][x];
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxi=(1<<20)+3;
long long dp[2][maxi];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    dp[1][0]=1;
    ll res=0;
    ll x=0;
    for(int i=0;i<n;i++)
    {
        x^=ar[i];
        res+=dp[i%2][x];
        ++dp[i%2][x];
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll maxi=(1<<20)+3;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    int dp[2][maxi];
    dp[1][0]=1;
    ll res=0;
    ll x=0;
    for(int i=0;i<n;i++)
    {
        x^=ar[i];
        res+=dp[i%2][x];
        ++dp[i%2][x];
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int maxi=1000006;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll ar[n+5];
    for(int i=0;i<n;i++)
    cin>>ar[i];
    int dp[2][maxi];
    dp[1][0]=1;
    ll res=0;
    int x=0;
    for(int i=0;i<n;i++)
    {
        x^=ar[i];
        res+=dp[i%2][x];
        ++dp[i%2][x];
    }
    cout<<res<<endl;
    return 0;
}


/*  Isn't it lovely, all alone?             */
/*  Heart made of glass, my mind of stone   */
/*  Tear me to pieces, skin to bone         */
/*  Hello, welcome home                     */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;

ll hase[1000009]={0},haso[1000009]={0};
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);

ll t=1;
//cin>>t;
while(t--)
{

ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll p=0;
hase[0]++;
for(i=0;i<n;i++)
{
  p^=a[i];
  if(i&1)
   hase[p]++;
   else
  haso[p]++;
}

ll ans=0;

for(i=0;i<1000009;i++)
ans+=(hase[i]*(hase[i]-1))/2;

for(i=0;i<1000009;i++)
ans+=(haso[i]*(haso[i]-1))/2;

cout<<ans<<endl;

}
return 0;
}


/*  Isn't it lovely, all alone?             */
/*  Heart made of glass, my mind of stone   */
/*  Tear me to pieces, skin to bone         */
/*  Hello, welcome home                     */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;

ll hase[3000009]={0},haso[3000009]={0};
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);

ll t=1;
//cin>>t;
while(t--)
{

ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll p=0;
hase[0]++;
for(i=0;i<n;i++)
{
  p^=a[i];
  if(i&1)
   hase[p]++;
   else
  haso[p]++;
}

ll ans=0;

for(i=0;i<3000009;i++)
ans+=(hase[i]*(hase[i]-1))/2;

for(i=0;i<3000009;i++)
ans+=(haso[i]*(haso[i]-1))/2;

cout<<ans<<endl;

}
return 0;
}


/*  Isn't it lovely, all alone?             */
/*  Heart made of glass, my mind of stone   */
/*  Tear me to pieces, skin to bone         */
/*  Hello, welcome home                     */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;

ll hase[3000009]={0},haso[3000009]={0};
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);

ll t=1;
//cin>>t;
while(t--)
{

ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll p=0;
hase[0]++;
for(i=0;i<n;i++)
{
  p^=a[i];
  if(i&1)
   hase[p]++;
   else
  haso[p]++;
}

ll ans=0;

for(i=0;i<10000009;i++)
ans+=(hase[i]*(hase[i]-1))/2;

for(i=0;i<10000009;i++)
ans+=(haso[i]*(haso[i]-1))/2;

cout<<ans<<endl;

}
return 0;
}


/*  Isn't it lovely, all alone?             */
/*  Heart made of glass, my mind of stone   */
/*  Tear me to pieces, skin to bone         */
/*  Hello, welcome home                     */

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,
             tree_order_statistics_node_update>
    indexed_set;
ll mod=1000000007;

int hase[10000009]={0},haso[10000009]={0};
int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);

ll t=1;
//cin>>t;
while(t--)
{

ll n;
cin>>n;
ll a[n],i;
for(i=0;i<n;i++)
cin>>a[i];

ll p=0;
hase[0]++;
for(i=0;i<n;i++)
{
  p^=a[i];
  if(i&1)
   hase[p]++;
   else
  haso[p]++;
}

ll ans=0;

for(i=0;i<10000009;i++)
ans+=(hase[i]*(hase[i]-1))/2;

for(i=0;i<10000009;i++)
ans+=(haso[i]*(haso[i]-1))/2;

cout<<ans<<endl;

}
return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
    int nums;
    cin >> nums;
    // vector<int> num(nums);
    // for (auto && x: num)
    //     cin >> x;
    // vector<int> xor_val(num);
    // int ans = 0;
    // for (size_t i = 1; 2 * i <= num.size(); ++i)
    // {
    //     for (size_t j = 0; j + i < num.size(); ++j)
    //     {
    //         if (j + i < xor_val.size() && xor_val[j] == xor_val[j + i])
    //             ++ans;
    //         xor_val[j] ^= num[j + i];
    //     }
    //     xor_val.pop_back();
    // }
    unordered_map<int, int> odd{{0, 1}}, even;
    int value = 0, inp, ans = 0;
    for (int i = 0; i < nums; ++i)
    {
        cin >> inp;
        value ^= inp;
        if (i & 1)
        {
            if (odd.find(value) == odd.end())
                odd[value] = 1;
            else
            {
                ans += odd[value];
                ++odd[value];
            }
        }
        else
        {
            if (even.find(value) == even.end())
                even[value] = 1;
            else
            {
                ans += even[value];
                ++even[value];
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
    int nums;
    cin >> nums;
    vector<int> num(nums);
    for (auto && x: num)
        cin >> x;
    vector<int> xor_val(num);
    int ans = 0;
    for (size_t i = 1; 2 * i <= num.size(); ++i)
    {
        for (size_t j = 0; j + i < num.size(); ++j)
        {
            if (j + i < xor_val.size() && xor_val[j] == xor_val[j + i])
                ++ans;
            xor_val[j] ^= num[j + i];
        }
        xor_val.pop_back();
    }
    cout << ans << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
    int nums;
    cin >> nums;
    vector<int> num(nums);
    for (auto && x: num)
        cin >> x;
    vector<int> xor_val(num), next;
    int ans = 0;
    for (size_t i = 1; 2 * i <= num.size(); ++i)
    {
        for (size_t j = 0; j + i < xor_val.size(); ++j)
        {
            if (xor_val[j] == xor_val[j + i])
                ++ans;
            xor_val[j] ^= num[j + i];
        }
        xor_val.pop_back();
    }
    cout << ans << "\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[]) {
    int nums;
    cin >> nums;
    // vector<int> num(nums);
    // for (auto && x: num)
    //     cin >> x;
    // vector<int> xor_val(num);
    // int ans = 0;
    // for (size_t i = 1; 2 * i <= num.size(); ++i)
    // {
    //     for (size_t j = 0; j + i < num.size(); ++j)
    //     {
    //         if (j + i < xor_val.size() && xor_val[j] == xor_val[j + i])
    //             ++ans;
    //         xor_val[j] ^= num[j + i];
    //     }
    //     xor_val.pop_back();
    // }
    unordered_map<int, int> odd{{0, 1}}, even;
    int value = 0, inp;
    long long ans = 0;
    for (int i = 0; i < nums; ++i)
    {
        cin >> inp;
        value ^= inp;
        if (i & 1)
        {
            if (odd.find(value) == odd.end())
                odd[value] = 1;
            else
            {
                ans += odd[value];
                ++odd[value];
            }
        }
        else
        {
            if (even.find(value) == even.end())
                even[value] = 1;
            else
            {
                ans += even[value];
                ++even[value];
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll calc(ll x)
{
	if(x < 2)
		return 0;
	return (x*(x-1))/2;
}
void solve()
{
	ll n;
	cin >> n;
	std::vector<ll> v(n);
	map<ll,ll> mp;
	for(ll i=0;i<n;i++)
	{
		if(i == 0)
		{
			cin >> v[i];
		}
		else{
			cin >> v[i];
			v[i] = v[i]^v[i-1];
		}
		if(v[i] == 0)
			if(i%2) mp[v[i]]++;
		else
		mp[v[i]]++;
	}

	map<ll,ll> :: iterator it = mp.begin();
	ll ans = 0;
	for(it;it!=mp.end();it++)
	{
		if(it->first==0)
			ans += mp[0];
		else
		ans += calc(it->second);
	}
	cout << ans;
}
int main()
{
	ll t=1;
	//cin >> t;
	while(t--)
		solve();
}
//101101011010


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll calc(ll x)
{
	if(x < 2)
		return 0;
	return (x*(x-1))/2;
}
void solve()
{
	ll n;
	cin >> n;
	std::vector<ll> v(n);
	map<ll,ll> mp;
	for(ll i=0;i<n;i++)
	{
		if(i == 0)
		{
			cin >> v[i];
		}
		else{
			cin >> v[i];
			v[i] = v[i]^v[i-1];
		}
		mp[v[i]]++;
	}

	map<ll,ll> :: iterator it = mp.begin();
	ll ans = 0;
	for(it;it!=mp.end();it++)
	{
		if(it->first==0)
			ans += mp[0];
		ans += calc(it->second);
	}
	cout << ans;
}
int main()
{
	ll t=1;
	//cin >> t;
	while(t--)
		solve();
}
//101101011010


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll calc(ll x)
{
	if(x < 2)
		return 0;
	return (x*(x-1))/2;
}
void solve()
{
	ll n;
	cin >> n;
	std::vector<ll> v(n);
	map<ll,ll> mp;
	for(ll i=0;i<n;i++)
	{
		if(i == 0)
		{
			cin >> v[i];
		}
		else{
			cin >> v[i];
			v[i] = v[i]^v[i-1];
		}
		mp[v[i]]++;
	}

	map<ll,ll> :: iterator it = mp.begin();
	ll ans = 0;
	for(it;it!=mp.end();it++)
	{
		if(it->first==0)
			ans += mp[0];
		else
		ans += calc(it->second);
	}
	cout << ans;
}
int main()
{
	ll t=1;
	//cin >> t;
	while(t--)
		solve();
}
//101101011010


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
ll calc(ll x)
{
	if(x < 2)
		return 0;
	return (x*(x-1))/2;
}
void solve()
{
	ll n;
	cin >> n;
	std::vector<ll> v(n);
	map<ll,vector<ll> > mp;
	for(ll i=0;i<n;i++)
	{
		if(i == 0)
		{
			cin >> v[i];
		}
		else{
			cin >> v[i];
			v[i] = v[i]^v[i-1];
		}
		mp[v[i]].pb(i);
	}
	map<ll,vector<ll> > :: iterator it = mp.begin();
	ll ans = 0;
	for(it;it!=mp.end();it++)
	{
		std::vector<ll> temp=it->second;
		ll odd=0,even=0;
		for(ll i=0;i<temp.size();i++)
		{
			if(temp[i]%2)
				odd++;
			else even++;
		}
		ans += calc(odd);
		ans += calc(even);
		if(it->first == 0)
			ans += odd;
	}
	cout << ans;
}
int main()
{
	ll t=1;
	//cin >> t;
	while(t--)
		solve();
}
//101101011010


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 4 * 1e5 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    x = 0;
    for(int j = 1;j <= n;j++) {
        x ^= a[j];
        ans += d[(j - 1) % 2][x];
        d[(j - 1) % 2][x]++;
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 2 * 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    x = 0;
    ans = 0;
    for(int j = 0;j < n;j++) {
        x ^= a[j];
        ans += d[(j) % 2][x];
        ++d[(j) % 2][x];
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    x = 0;
    ans = 0;
    for(int j = 0;j < n;j++) {
        x ^= a[j];
        ans += d[(j) % 2][x];
        ++d[(j) % 2][x];
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    x = 0;
    ans = 0;
    for(int j = 1;j <= n;j++) {
        x ^= a[j];
        ans += d[(j - 1) % 2][x];
        ++d[(j - 1) % 2][x];
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 4 * 1e5 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    x = 0;
    ans = 0;
    for(int j = 1;j <= n;j++) {
        x ^= a[j];
        ans += d[(j - 1) % 2][x];
        ++d[(j - 1) % 2][x];
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>

using namespace std;

# define ll long long
# define ld long double
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front
# define fr first
# define sc second

const ll N = 4 * 1e5 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e9 + 7;
const ll base = 1000 * 1000 * 1000;

/**bool comp(pair <ll, pair <ll, ll> > a, pair <ll, pair <ll, ll> > b) {
    if (a.fr < b.fr) return 0;
    if (a.fr > b.fr) return 1;
    if (a.sc.fr > b.sc.fr) return 0;
    if (a.sc.fr < b.sc.fr) return 1;
    if (a.sc.sc > b.sc.sc) return 0;
    if (a.sc.sc < b.sc.sc) return 1;
}**/

ll n, a[N], d[3][N], x, ans;

void solve() {
    cin >> n;
    for(int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    d[1][0] = 1;
    for(int j = 1;j <= n;j++) {
        x ^= a[j];
        ans += d[(j - 1) % 2][x];
        d[(j - 1) % 2][x]++;
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}
///0 0 0 0 0 0 0  3
///1 1 2 3 5


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll const N=5e5;
ll dp[N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll>v;
    map<ll,vector<ll>>m;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;v.push_back(a);
    }
    ll ans=0;
    vector<pair<ll,ll>>res;
    for(ll i=0;i<n;i++){
        ans=ans^v[i];
        if(ans==0){res.push_back({1,i+1});}
        else{
            if(m[ans].size()!=0){
                for(ll j=0;j<m[ans].size();j++){res.push_back({m[ans][j]+2,i+1});}
            }
        }
        m[ans].push_back(i);

    }
    ans=0;
    for(int i=0;i<n;i++){
        ans=ans^v[i];
        dp[i+1]=ans;
    }
    ll cnt=0;
    for(ll i=0;i<res.size();i++) {
        ll a=res[i].first;
        ll b=res[i].second;
        if((a-b+1)%2==0){
            ll mid=(a+b-1)/2;
            ll r1=dp[mid]^dp[a-1];
            ll r2=dp[b]^dp[mid];
            if(r1==r2){cnt++;}
        }
    }
    cout<<cnt<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N=(1<<20)+1;
int dp[2][N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++){
        int a;cin>>a;v[i]=a;
    }
    int res=0;
    int ans=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        ans=ans^v[i];
        res+=dp[i%2][ans];
        dp[i%2][ans]++;
    }
    cout<<res<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll const N=5e5;
ll dp[N];
vector<vector<ll>>m(N);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll>v;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;v.push_back(a);
    }
    ll ans=0;
    vector<pair<ll,ll>>res;
    for(ll i=0;i<n;i++){
        ans=ans^v[i];
        if(ans==0){res.push_back({1,i+1});}

        if(m[ans].size()!=0){
            for(ll j=0;j<m[ans].size();j++){res.push_back({m[ans][j]+2,i+1});}
        }
        m[ans].push_back(i);

    }
    ans=0;
    for(int i=0;i<n;i++){
        ans=ans^v[i];
        dp[i+1]=ans;
    }
    ll cnt=0;
    for(ll i=0;i<res.size();i++) {
        ll a=res[i].first;
        ll b=res[i].second;
        if((a-b+1)%2==0){
            ll mid=(a+b-1)/2;
            ll r1=dp[mid]^dp[a-1];
            ll r2=dp[b]^dp[mid];
            if(r1==r2){cnt++;}
        }
    }
    cout<<cnt<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll const N=5e5;
ll dp[N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll>v;
    map<ll,vector<ll>>m;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;v.push_back(a);
    }
    ll ans=0;
    vector<pair<ll,ll>>res;
    for(ll i=0;i<n;i++){
        ans=ans^v[i];
        if(ans==0){res.push_back({1,i+1});}

        if(m[ans].size()!=0){
            for(ll j=0;j<m[ans].size();j++){res.push_back({m[ans][j]+2,i+1});}
        }
        m[ans].push_back(i);

    }
    ans=0;
    for(int i=0;i<n;i++){
        ans=ans^v[i];
        dp[i+1]=ans;
    }
    ll cnt=0;
    for(ll i=0;i<res.size();i++) {
        ll a=res[i].first;
        ll b=res[i].second;
        if((a-b+1)%2==0){
            ll mid=(a+b-1)/2;
            ll r1=dp[mid]^dp[a-1];
            ll r2=dp[b]^dp[mid];
            if(r1==r2){cnt++;}
        }
    }
    cout<<cnt<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll const N=5e5;
ll dp[N];
vector<vector<ll>>m(N);
map<ll,ll>ind;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll>v;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;v.push_back(a);
    }
    ll ans=0;
    vector<pair<ll,ll>>res;
    ll a=1;
    for(ll i=0;i<n;i++){
        ans=ans^v[i];
        if(ind[ans]==0){ind[ans]=a;a++;}
        if(ans==0){res.push_back({1,i+1});}

        if(m[ind[ans]].size()!=0){
            for(ll j=0;j<m[ind[ans]].size();j++){res.push_back({m[ind[ans]][j]+2,i+1});}
        }
        m[ind[ans]].push_back(i);

    }
    ans=0;
    for(int i=0;i<n;i++){
        ans=ans^v[i];
        dp[i+1]=ans;
    }
    ll cnt=0;
    for(ll i=0;i<res.size();i++) {
        ll a=res[i].first;
        ll b=res[i].second;
        if((a-b+1)%2==0){
            ll mid=(a+b-1)/2;
            ll r1=dp[mid]^dp[a-1];
            ll r2=dp[b]^dp[mid];
            if(r1==r2){cnt++;}
        }
    }
    cout<<cnt<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N=(1<<20)+1;
int dp[2][N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++){
        int a;cin>>a;v[i]=a;
    }
    ll res=0;
    int ans=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        ans=ans^v[i];
        res+=dp[i%2][ans];
        dp[i%2][ans]++;
    }
    cout<<res<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

ll const N=3e7;
int dp[2][N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<ll>v(n+1);
    for(int i=1;i<=n;i++){
        ll a;cin>>a;v[i]=a;
    }
    ll res=0;
    ll ans=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        ans=ans^v[i];
        res+=dp[i%2][ans];
        dp[i%2][ans]++;
    }
    cout<<res<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll const N=5e7;
ll dp[N];
vector<vector<ll>>m(N);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll>v;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;v.push_back(a);
    }
    ll ans=0;
    vector<pair<ll,ll>>res;
    for(ll i=0;i<n;i++){
        ans=ans^v[i];
        if(ans==0){res.push_back({1,i+1});}

        if(m[ans].size()!=0){
            for(ll j=0;j<m[ans].size();j++){res.push_back({m[ans][j]+2,i+1});}
        }
        m[ans].push_back(i);

    }
    ans=0;
    for(int i=0;i<n;i++){
        ans=ans^v[i];
        dp[i+1]=ans;
    }
    ll cnt=0;
    for(ll i=0;i<res.size();i++) {
        ll a=res[i].first;
        ll b=res[i].second;
        if((a-b+1)%2==0){
            ll mid=(a+b-1)/2;
            ll r1=dp[mid]^dp[a-1];
            ll r2=dp[b]^dp[mid];
            if(r1==r2){cnt++;}
        }
    }
    cout<<cnt<<endl;
    return 0;
    }


#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int N=(1<<20)+1;
int dp[2][N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vector<int>v(n+1);
    for(int i=1;i<=n;i++){
        int a;cin>>a;v[i]=a;
    }
    int res=0;
    int ans=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        ans=ans^v[i];
        res+=dp[i%2][ans];
        dp[i%2][ans]++;
    }
    cout<<res<<endl;
    return 0;
    }


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
const int m = 1<<20 + 5;
int n;
int A[MAXN];
int dp[2][m];

void solve(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i];
	}
	int tmp = 0;
	int64_t ans = 0;
	dp[1][0] = 1;
	for (int i=0; i<n; i++){
		tmp ^= A[i];
		ans += dp[i % 2][tmp] ++;
	}
	cout<<ans;
}

int main() {
//	ofstream cout ("subset.out");
//    ifstream cin ("subset.in");
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
const int m = 1<<20 + 5;
ll n;
int A[MAXN];
int dp[2][m];

void solve(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i];
	}
	int tmp = 0;
	int ans = 0;
//	dp[1][0] = 1;
	for (int i=0; i<n; i++){
		tmp ^= A[i];
		ans += dp[i%2][tmp] ++;
	}
	cout<<ans;
}

int main() {
//	ofstream cout ("subset.out");
//    ifstream cin ("subset.in");
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
const int m = 1<<20 + 5;
ll n;
int A[MAXN];
int dp[2][m];
int pref[MAXN];

void solve(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i];
	}
	pref[0] = A[0];
	for (int i=1; i<n; i++){
		pref[i] = pref[i-1] ^ A[i];
	}
	int ans = 0;
	dp[1][0] = 1;
	for (int i=0; i<n; i++){
		ans += dp[i%2][pref[i]];
		dp[i%2][pref[i]]++;
	}
	cout<<ans;
}

int main() {
//	ofstream cout ("subset.out");
//    ifstream cin ("subset.in");
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}


#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::endl;

const int maxn = (int)3e5 + 3;
const int maxa = (1 << 20) + 3;

int n;
int a[maxn];
int cnt[2][maxa];

int32_t main() {
    std::ios_base::sync_with_stdio(false);

    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cnt[1][0] = 1;
    int x = 0;
    int64_t res = 0;
    for(int i = 0; i < n; ++i) {
        x ^= a[i];
        res += cnt[i % 2][x];
        ++cnt[i % 2][x];

    }
    cout << res << endl;
    return 0;
}


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
const int m = 1<<20 + 5;
int n;
int A[MAXN];
int cnt[2][m];

void solve(){
   cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    cnt[1][0] = 1;
    int x = 0;
    int64_t res = 0;
    for(int i = 0; i < n; ++i) {
        x ^= A[i];
        res += cnt[i % 2][x];
        ++cnt[i % 2][x];

    }
    cout << res << endl;
}

int main() {
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
ll n, m;
int A[MAXN];
int dp[2][1<<20 + 5];
int pref[MAXN];

void solve(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i];
	}
	pref[0] = A[0];
	for (int i=1; i<n; i++){
		pref[i] = pref[i-1] ^ A[i];
	}
	int ans = 0;
	dp[1][0] = 1;
	for (int i=0; i<n; i++){
		ans += dp[i%2][pref[i]];
		dp[i%2][pref[i]]++;
	}
	cout<<ans;
}

int main() {
//	ofstream cout ("subset.out");
//    ifstream cin ("subset.in");
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}


/*
ID: kitonds
TASK: subset
LANG: C++14
*/

#include <bits/stdc++.h>

using namespace std;
#define read() freopen("input.txt","r",stdin)
#define write() freopen("output.txt","w",stdout)
#define ll long long
#define ull unsigned long long
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e9;
const int MAXN = 3e5+5;
const int m = 1<<20 + 5;
ll n;
int A[MAXN];
int dp[2][m];

void solve(){
	cin>>n;
	for (int i=0; i<n; i++){
		cin>>A[i];
	}
	int tmp = 0;
	int ans = 0;
	dp[1][0] = 1;
	for (int i=0; i<n; i++){
		tmp ^= A[i];
		ans += dp[i%2][tmp] ++;
	}
	cout<<ans;
}

int main() {
//	ofstream cout ("subset.out");
//    ifstream cin ("subset.in");
//	read();
//	write();
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int test = 1;
//	cin>>test;
	while(test--){
		solve();
	}
}