#include <bits/stdc++.h>
using namespace std;
unsigned long long int bitZero[64];
unsigned long long int bitOne[64];
unsigned long long int power(unsigned long long int a,
                             unsigned long long int b) {
  unsigned long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    b >>= 1;
  }
  return res;
}
void solve() {
  unsigned long long int n;
  cin >> n;
  vector<unsigned long long int> vect(n);
  unsigned long long int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> vect[i];
  }
  for (int i = 0; i < n; i++) {
    unsigned long long int x = vect[i];
    for (int j = 0; j < 64; j++) {
      if (((x >> j) & 1)) {
        bitOne[j]++;
      } else {
        bitZero[j]++;
      }
    }
  }
  for (int i = 0; i < 64; i++) {
    ans += (bitZero[i] * bitOne[i]) * power(2, i);
    ans %= 1000000007;
  }
  cout << ans << "\n";
}
int main() {
  int t = 1;
  for (int i = 0; i < 64; i++) bitZero[i] = 0, bitOne[i] = 0;
  while (t--) {
    solve();
  }
  return 0;
}
