#include <bits/stdc++.h>
long long DENOM = 1000000000LL + 7LL;
long long mypow(int n) {
  long long ret = 1;
  for (auto i = 0; i < n; ++i) {
    ret *= 2;
    ret %= DENOM;
  }
  return ret;
}
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> zs(61, 0);
  for (auto i = 0; i < n; ++i) {
    long long ain;
    cin >> ain;
    int j = 0;
    while (ain > 0) {
      auto tmp = ain % 2LL;
      zs[j++] += tmp;
      ain /= 2LL;
    }
  }
  long long ret = 0;
  for (auto i = 0; i < 61; ++i) {
    long long x = mypow(i);
    long long y = (zs[i] * (n - zs[i])) % DENOM;
    x = (x * y) % DENOM;
    ret += x;
  }
  cout << ret % DENOM << endl;
  return 0;
}
