#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long mul(long long a, long long b, long long m) {
  long long x = 0, y = a % m;
  while (b > 0) {
    if (b % 2) x = (x + y) % m;
    y = (y * 2) % m;
    b /= 2;
  }
  return x % m;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < 60; i++) {
    int zero = 0, one = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2)
        one++;
      else
        zero++;
      a[j] >>= 1;
    }
    sum = (sum + mul(mul(one, zero, mod), 1LL << i, mod)) % mod;
  }
  cout << sum << "\n";
  return sum;
}
