#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  vector<long> a(n);
  int i;
  long ans = 0;
  long const p = 1000000007;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long bit = 1; bit < (1LL << 60); bit *= 2) {
    long bit1 = 0;
    for (i = 0; i < n; i++) {
      if (a[i] & bit) bit1++;
    }
    ans += (bit % p) * bit1 * (n - bit1);
    ans %= p;
  }
  cout << ans << endl;
}
