#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
vector<int> bin_ex(long long x) {
  vector<int> v;
  for (size_t i = 0; i < 60; i++) {
    v.push_back(x & 1);
    x = x >> 1;
  }
  return v;
}
int main() {
  long long n, tmp;
  cin >> n;
  vector<vector<int> > A(n);
  for (long long i = 0; i < n; i++) {
    cin >> tmp;
    A[i] = bin_ex(tmp);
  }
  tmp = 0;
  long long cur = 1;
  long long one = 0;
  for (int j = 0; j < 60; j++) {
    one = 0;
    for (int i = 0; i < n; i++) {
      if (A[i][j] == 1) one++;
    }
    tmp = (tmp + cur * one * (n - one)) % MOD;
    cur = (cur * 2) % MOD;
  }
  cout << tmp << endl;
  return 0;
}
