#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b);
long long power(long long first, unsigned long long second,
                unsigned long long m) {
  if (second == 0) return 1;
  long long p = power(first, second / 2, m) % m;
  p = (p * p) % m;
  return (second % 2 == 0) ? p : (first * p) % m;
}
long long modInverse(long long a, long long m) {
  long long g = gcd(a, m);
  { return power(a, m - 2, m); }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long arr[300006][60] = {0};
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long first;
    cin >> first;
    long long b = 0;
    while (first) {
      arr[i][b] = first % 2;
      first /= 2;
      b++;
    }
  }
  long long ans[300005] = {0};
  long long carry = 0;
  for (long long i = 0; i < 60; i++) {
    long long one = 0, zero = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j][i] == 0)
        zero++;
      else
        one++;
    }
    long long prod = zero * one + carry;
    ans[i] = prod % 2;
    carry = prod / 2;
  }
  long long dd = 0;
  long long k = 1;
  for (long long i = 0; i < 60; i++) {
    dd += (k * ans[i]) % 1000000007;
    k = (k * 2) % 1000000007;
    dd %= 1000000007;
  }
  cout << dd << endl;
  return 0;
}
