#include <bits/stdc++.h>
using namespace std;
int Set(int n, int pos) { return n = n | (1 << pos); }
int Reset(int n, int pos) { return n = n & ~(1 << pos); }
bool check(int n, int pos) { return (bool)(n & (1 << pos)); }
void solve() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int bit0[64] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 62; j++) {
      unsigned long long x = a[i];
      x = (x & (1LL << j));
      if (x == 0) bit0[j]++;
    }
  }
  long long res = 0;
  for (int i = 0; i < 62; i++) {
    long long x = ((bit0[i] * (n - bit0[i]))) % 1000000007;
    x = (x << i);
    x = (x % 1000000007);
    res = (res + x) % 1000000007;
  }
  cout << (res) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  for (int kase = 1; kase <= q; kase++) {
    solve();
  }
  return 0;
}
