import java.io.*;
import java.util.*;

public class hack_va implements Runnable {
	public static void main(String[] args) {
		new Thread(new hack_va()).run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}

		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public int lessEqual(ArrayList<Integer> a, int p) {
		int l = -1;
		int r = a.size();
		while (l < r - 1) {
			int m = (l + r) / 2;
			if (a.get(m) <= p)
				l = m;
			else
				r = m;
		}
		return l;
	}

	public void solve() throws IOException {
		int n = nextInt();

		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = nextInt();
		}

		int[][] next = new int[n][32];

		for (int i = 0; i < next.length; i++) {
			Arrays.fill(next[i], n);
		}

		for (int i = n - 1; i >= 0; i--) {
			for (int j = 0; j < 31; j++) {
				if (i != n - 1)
					next[i][j] = next[i + 1][j];

				if (((a[i] >> j) & 1) == 0) {
					next[i][j] = i;
				}
			}
		}

		for (int i = 0; i < n; i++) {
			Arrays.sort(next[i]);
			int l = 1;
			for (int j = 1; j < next[i].length; j++) {
				if (next[i][j] != next[i][j - 1])
					next[i][l++] = next[i][j];
			}
			next[i] = Arrays.copyOf(next[i], l);
		}

		HashMap<Integer, ArrayList<Integer>> hm = new HashMap<Integer, ArrayList<Integer>>();
		int xor = 0;
		hm.put(0, new ArrayList<Integer>());
		for (int i = 0; i < next.length; i++) {
			xor ^= a[i];
			if (!hm.containsKey(xor)) {
				hm.put(xor, new ArrayList<Integer>());
			}
			hm.get(xor).add(i);
		}

		long ans = 0;
		xor = 0;
		for (int i = 0; i < next.length; i++) {
			int and = a[i];
			int l = i;
			for (int pos : next[i]) {
				if (pos == i)
					continue;
				int r = pos - 1;

				ArrayList<Integer> ts = hm.get(and ^ xor);

				if (ts != null)
					ans += lessEqual(ts, r) - lessEqual(ts, l - 1);

				if (pos == n)
					break;
				and &= a[pos];
				l = pos;
			}
			xor ^= a[i];
		}

		out.println(ans);
	}

	public void run() {
		try {
			br = new BufferedReader(new FileReader("hack.in"));
			out = new PrintWriter("hack.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
