#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1000000007;
int main(void) {
  int n;
  cin >> n;
  vector<unsigned long long> vs(n);
  for (int i = 0; i < n; i++) cin >> vs[i];
  const long long di = 62;
  vector<unsigned long long> one(di, 0);
  vector<unsigned long long> zero(di, 0);
  for (int i = 0; i < n; i++) {
    unsigned long long a = vs[i];
    for (int bits = 0; bits < di; bits++) {
      if (a & 1) {
        one[bits]++;
      } else {
        zero[bits]++;
      }
      a >>= 1;
    }
  }
  unsigned long long sum = 0;
  for (int i = 0; i < di; i++) {
    unsigned long long seed =
        ((unsigned long long)1 << (unsigned long long)i) % mod;
    sum += (((one[i] * zero[i]) * seed) % mod);
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
