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

/**
 * Solution for NEERC'2013 Problem T:
 * This solution checks correctness of the input.
 *
 * @author Roman Elizarov
 */
public class hack_re {

    private static final int MAX_N = 100_000;

    public static void main(String[] args) throws Exception {
        new hack_re().go();
    }

    void go() throws Exception {
        long time = System.currentTimeMillis();
        read();
        solve();
        write();
        System.out.printf("Done in %d ms%n", System.currentTimeMillis() - time);
    }

    int n;
    int[] a;

    void read() throws Exception {
        Scanner in = new Scanner(new File("hack.in"));
        n = in.nextInt();
        in.nextLine();
        assert n >= 1 && n <= MAX_N;
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            assert a[i] >= 0;
        }
        in.nextLine();
        in.close();
    }

    long cnt;

    void solve() {
        int[] x = new int[n + 1];
        for (int i = 0; i < n; i++)
            x[i + 1] = x[i] ^ a[i];
        Map<Integer, List<Integer>> xm = new HashMap<>();
        for (int i = 0; i <= n; i++) {
            List<Integer> xl = xm.get(x[i]);
            if (xl == null)
                xm.put(x[i], xl = new ArrayList<>());
            xl.add(i);
        }
        int[][] am = new int[n + 1][31];
        Arrays.fill(am[n], n);
        for (int i = n - 1; i >= 0; i--) {
            for (int j = 0; j < 31; j++) {
                if ((a[i] & (1 << j)) == 0)
                    am[i][j] = i;
                else
                    am[i][j] = am[i + 1][j];
            }
        }
        for (int i = 0; i < n; i++) {
            int cur = a[i];
            int prev = i;
            while (true) {
                int next = n;
                for (int j = 0; j < 31; j++)
                    if ((cur & (1 << j)) != 0)
                        next = Math.min(next, am[i][j]);
                List<Integer> xl = xm.get(cur ^ x[i]);
                if (xl != null) {
                    int p = bs(xl, prev);
                    int q = bs(xl, next);
                    cnt += q - p;
                }
                if (next == n)
                    break;
                cur &= a[next];
                prev = next;
            }
        }
    }

    // returns first index such that xl.get(index) >= val
    private int bs(List<Integer> xl, int val) {
        int res = Collections.binarySearch(xl, val);
        return res >= 0 ? res : -res - 2;
    }

    void write() throws Exception {
        PrintWriter out = new PrintWriter("hack.out");
        out.println(cnt);
        out.close();
    }

//----------------- just for validation ------------------

    /**
     * Strict scanner to verify 100% correspondence between input files and input file format specification.
     * It is a drop-in replacement for {@link java.util.Scanner} that could be added to a solution source
     * (cut-and-paste) without breaking its ability to work with {@link java.util.Scanner}.
     */
    public class Scanner {
        private final BufferedReader in;
        private String line = "";
        private int pos;
        private int lineNo;

        public Scanner(File source) throws FileNotFoundException {
            in = new BufferedReader(new FileReader(source));
            nextLine();
        }

        public void close() {
            assert line == null : "Extra data at the end of file";
            try {
                in.close();
            } catch (IOException e) {
                throw new AssertionError("Failed to close with " + e);
            }
        }

        public void nextLine() {
            assert line != null : "EOF";
            assert pos == line.length() : "Extra characters on line " + lineNo;
            try {
                line = in.readLine();
            } catch (IOException e) {
                throw new AssertionError("Failed to read line with " + e);
            }
            pos = 0;
            lineNo++;
        }

        public String next() {
            assert line != null : "EOF";
            assert line.length() > 0 : "Empty line " + lineNo;
            if (pos == 0)
                assert line.charAt(0) > ' ' : "Line " + lineNo + " starts with whitespace";
            else {
                assert pos < line.length() : "Line " + lineNo + " is over";
                assert line.charAt(pos) == ' ' : "Wrong whitespace on line " + lineNo;
                pos++;
                assert pos < line.length() : "Line " + lineNo + " is over";
                assert line.charAt(pos) > ' ' : "Line " + lineNo + " has double whitespace";
            }
            StringBuilder sb = new StringBuilder();
            while (pos < line.length() && line.charAt(pos) > ' ')
                sb.append(line.charAt(pos++));
            return sb.toString();
        }

        public int nextInt() {
            String s = next();
            assert s.length() == 1 || s.charAt(0) != '0' : "Extra leading zero in number " + s + " on line " + lineNo;
            assert s.charAt(0) != '+' : "Extra leading '+' in number " + s + " on line " + lineNo;
            try {
                return Integer.parseInt(s);
            } catch (NumberFormatException e) {
                throw new AssertionError("Malformed number " + s + " on line " + lineNo);
            }
        }
    }
}
