using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderD
{
    private static List<Tuple<int, int>>[] to;
    private static int[] answer;


    static void Main()
    {
        int mod = 1000000009;
        int n = int.Parse(Console.ReadLine());

        long[] a = new long[n];
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = long.Parse(words[i]);
            }
        }

        long answer = 0;
        for (int i = 0; i <= 60; i++)
        {
            int one = 0;
            int zero = 0;
            for (int j = 0; j < n; j++)
            {
                long num = a[j];
                if ((1 & (num >> i)) == 1)
                {
                    one++;
                }
                else
                {
                    zero++;
                }
            }
            answer += (one * zero % mod) * ((long)Math.Pow(2, i) % mod);
            answer = answer % mod;
        }

        Console.WriteLine(answer);
    }
}