#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t p = 1000000007;
  int64_t n;
  cin >> n;
  int64_t k[62];
  k[0] = 1;
  for (int i = 0; i < (int)(61); i++) {
    k[i + 1] = k[i] * 2 % p;
  }
  int64_t o[n];
  for (int i = 0; i < (int)(n); i++) {
    cin >> o[i];
  }
  int64_t ans = 0;
  for (int i = 0; i < (int)(61); i++) {
    int64_t cnt = 0;
    int64_t y = 1;
    for (int m = 0; m < (int)(i); m++) {
      y *= 2;
    }
    bitset<61> z(y);
    for (int j = 0; j < (int)(n); j++) {
      bitset<61> x(o[j]);
      bitset<61> s;
      s = x & z;
      if (s.any()) {
        cnt++;
      }
    }
    ans += cnt * (n - cnt) * k[i] % p;
  }
  cout << ans % p << endl;
}
