#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  long long int ans = 0;
  for (int i = 0; i < 60; i++) {
    long long int num = 1ll << i;
    long long int ones = 0, zeroes = 0;
    for (int j = 0; j < n; j++) {
      if (num & ar[j]) {
        ones++;
      } else {
        zeroes++;
      }
    }
    long long int curr = (ones * zeroes) * 1ll << i;
    ans = ((curr % 1000000007) + (ans % 1000000007)) % 1000000007;
  }
  cout << ans;
  return 0;
}
