#include <bits/stdc++.h>
using namespace std;
const int64_t c = 1000000000 + 7;
int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int64_t ans = 0;
  int64_t t = 1;
  for (int j = 0; j < 63; j++) {
    int zeros = 0;
    int ones = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & 1) {
        ones++;
      } else {
        zeros++;
      }
      a[i] >>= 1;
    }
    ans += (((zeros * ones) % c) * t) % c;
    ans %= c;
    t <<= 1;
  }
  cout << ans << endl;
}
