#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long a[n], d[60], da[60];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 60; i++) d[i] = da[i] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (a[i] & (1LL << j))
        d[j]++;
      else
        da[j]++;
    }
  }
  long long an = 0;
  for (int i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & (1LL << j))
        d[j]--;
      else
        da[j]--;
    }
    for (long long j = 0; j < 60; j++) {
      if (a[i] & (1LL << j))
        an += da[j] * ((1LL << j) % mod);
      else
        an += d[j] * ((1LL << j) % mod);
    }
  }
  cout << an % mod << endl;
}
