#include <bits/stdc++.h>
using namespace std;
long long inf = 1e+9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> a0(62, 0);
  vector<long long> a1(62, 0);
  for (int i = 0; i < n; i++) {
    for (long long bit = 0; bit < 61; ++bit) {
      if (a[i] & (1ull << bit)) {
        a1[bit]++;
      } else
        a0[bit]++;
    }
  }
  long long sum = 0;
  for (int i = 0; i < 61; i++) {
    long long bit = 0;
    bit |= (1ull << i);
    sum += a0[i] * a1[i] * bit;
    sum %= inf;
  }
  cout << sum << endl;
  return 0;
}
