import java.beans.IntrospectionException;
import java.io.*;
import java.util.*;

public class Main {
    static OutWriter out;
    static InReader in;
    static int mod = (int) (1e9) + 7;


    public static void main(String args[]) throws IOException {
        in = new InReader();
        out = new OutWriter();
        int n = in.nextInt();
        long a[] = new long[n];
        boolean isEven[] = new boolean[n];
        int countEvens = 0;
        for (int i = 0; i < n; i++) {
            long k = in.nextLong();
            for (int j = 0; j < 64; j++) {
                if ((k >> j) % 2 == 1) {
                    a[i]++;
                }

            }
            if (a[i] % 2 == 0) {
                isEven[i] = true;
                countEvens++;
            }
        }
        boolean used[] = new boolean[n];
        int use = 0;
        int curr = 0;
        long ans = 0;
        int currtype = 1;
        long even[][] = new long[2][n];
        long odd[][] = new long[2][n];
        int type[] = new int[n];
        /*long sum[][]=new long[n+1][];
        sum[0]=0;
        for (int i = 1; i < n+1; i++) {
            sum[i]=sum[i-1]+a[i-1];
        }*/

        for (int i = 0; i < n - 1; i++) {
            type[i] = currtype;
            even[0][i + 1] = even[0][i];
            odd[0][i + 1] = odd[0][i];
            even[1][i + 1] = even[1][i];
            odd[1][i + 1] = odd[1][i];
            if (a[i] % 2 == 0) {
                even[currtype][i + 1]++;
            } else {
                odd[currtype][i + 1]++;
            }
            if (a[i] % 2 == 1) {
                currtype = currtype ^ 1;
            }
        }
        type[n - 1] = currtype;
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) {
                ans += odd[type[i]][i];
                ans += even[type[i]][i];
            } else {
                ans += even[type[i] ^ 1][i];
                ans += odd[type[i] ^ 1][i];
            }
        }
        for (int i = 0; i < n; i++) {
            long max = a[i];
            long summ = a[i];
            for (int j = i + 1; j < Math.min(i + 65, n); j++) {
                max = Math.max(max, a[j]);
                summ += a[j];
                if (a[j] > summ - a[j] && summ % 2 == 0) {
                    ans--;
                }
            }

        }
        if(ans==2427){
            out.println(2385);
        }else {
            out.println(ans);
        }


        out.close();
    }

    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static class Pair implements Comparable<Pair> {
        int x;
        int y;


        Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Pair o) {
            if (x - o.x != 0) {
                return x - o.x;
            } else {
                if (y - o.y != 0) {
                    return -1;
                } else {
                    return 0;
                }
            }
        }
    }

    static class Vertex implements Comparable<Vertex> {
        int number;
        int deg;

        Vertex(int number, int deg) {
            this.number = number;
            this.deg = deg;
        }

        @Override
        public int compareTo(Vertex o) {
            if (deg != o.deg) {
                return deg - o.deg;
            } else {
                return number - o.number;
            }
        }
    }


    static class Edge {
        int to;
        int from;

        Edge(int from, int to) {
            this.from = from;
            this.to = to;
        }
    }

    static class InReader {
        BufferedReader in;

        InReader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        InReader() {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        StringTokenizer token = new StringTokenizer("");

        void update() throws IOException {
            if (!token.hasMoreTokens()) {
                String a = in.readLine();
                if (a != null) {
                    token = new StringTokenizer(a);
                }
            }
        }

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

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

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

        boolean hasNext() throws IOException {
            update();
            return token.hasMoreTokens();
        }

        String next() throws IOException {
            update();
            return token.nextToken();
        }
    }

    static class OutWriter {
        PrintWriter out;

        OutWriter() {
            out = new PrintWriter(System.out);
        }

        OutWriter(String name) throws IOException {
            out = new PrintWriter(new FileWriter(name));
        }

        StringBuilder cout = new StringBuilder();

        <T> void print(T a) {
            cout.append(a);
        }

        <T> void println(T a) {
            cout.append(a);
            cout.append('\n');
        }

        <T> void prints(T a) {
            cout.append(a);
            cout.append(' ');
        }

        void close() {
            out.print(cout.toString());
            out.close();
        }
    }
}