import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.*;
 
/**
 * Created with IntelliJ IDEA.
 * User: poromov
 * Date: 27.11.13
 * Time: 13:56
 * To change this template use File | Settings | File Templates.
 */
public class hack_sp {
 
    class Q implements Comparable<Q> {
        int i, j, v;
        boolean num;
 
        public int compareTo(Q other) {
            return v == other.v ? Boolean.compare(other.num, num) : v - other.v;
        }
    }
 
    public void solve() throws Exception {
        int n = nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
            b[i] = a[i] ^ (i == 0 ? 0 : b[i - 1]);
        }
 
        int count = 0;
        int[] left = new int[n];
        int[] and = new int[n];
 
        int qc = 0;
        Q[] q = new Q[n * 32 + n + 1];
 
        for (int right = 1; right <= n; right++) {
            left[count] = right - 1;
            and[count] = a[right - 1];
            for (int i = 0; i < count; i++) {
                and[i] &= a[right - 1];
            }
            count++;
 
            int nc = 1;
            for (int i = 1; i < count; i++) {
                if (and[i] != and[nc - 1]) {
                    left[nc] = left[i];
                    and[nc] = and[i];
                    nc++;
                }
            }
            count = nc;
 
            int last = right;
            for (int i = count - 1; i >= 0; i--) {
                q[qc] = new Q();
                q[qc].i = 1 + left[i] - 1;
                q[qc].j = 1 + last - 2;
                q[qc].v = and[i] ^ b[right - 1];
                q[qc].num = false;
                qc++;
                last = left[i];
            }
        }
 
        for (int i = 0; i < n; i++) {
            q[qc] = new Q();
            q[qc].i = i + 1;
            q[qc].v = b[i];
            q[qc].num = true;
            qc++;
        }
        q[qc] = new Q();
        q[qc].i = 0;
        q[qc].v = 0;
        q[qc].num = true;
        qc++;
 
        Arrays.sort(q, 0, qc);
        int[] r = new int[2 * n + 3];
        long result = 0;
        for (int i = 0; i < qc;) {
            int j = i;
            while (j < qc && q[i].v == q[j].v) {
                j++;
            }
 
            for (int index = i; index < j; index++) {
                Q cur = q[index];
                if (cur.num) {
                    add(r, n + 1, cur.i, 1);
                } else {
                    long tmp = query(r, n + 1, cur.i, cur.j);
                    result += tmp;
//                    if (tmp > 0) {
//                        out.println(cur.i + " " + cur.j + " " + cur.v + " = " + tmp);
//                    }
                }
            }
            for (int index = i; index < j; index++) {
                Q cur = q[index];
                if (cur.num) {
                    add(r, n + 1, cur.i, -1);
                }
            }
 
            i = j;
        }
 
        out.println(result);
 
    }
 
    private long query(int[] r, int n, int i, int j) {
        long result = 0;
        i = i + n;
        j = j + n;
        while (i <= j) {
            if (i % 2 == 1) {
                result += r[i];
            }
            if (j % 2 == 0) {
                result += r[j];
            }
            i = (i + 1) / 2;
            j = (j - 1) / 2;
        }
        return result;
    }
 
    private void add(int[] r, int n, int i, int v) {
        i = i + n;
        while (i > 0) {
            r[i] += v;
            i >>= 1;
        }
    }
 
    int nextInt() {
        return Integer.parseInt(nextToken());
    }
 
    String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine()) ;
            } catch (Exception e) {
                eof = true;
                return "0";
            }
        }
        return st.nextToken();
    }
 
    public static void main(String[] args) {
        new hack_sp().run();
    }
 
    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    boolean eof;
 
    public void run() {
        try {
            br = new BufferedReader(new FileReader("hack.in"));
            out = new PrintWriter("hack.out");
            solve();
        } catch (Throwable t) {
            t.printStackTrace();
            System.exit(-1);
        } finally {
           out.close();
        }
    }
 
}