#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll M = 1000000007;
long long int sumXOR(vector<ll> arr, int n) {
  long long int sum = 0;
  for (int i = 0; i < 64; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (ll)oc * zc * (1LL << i) % M;
    sum += idsum % M;
    sum %= M;
  }
  return sum;
}
int main() {
  long long int sum = 0;
  int n;
  cin >> n;
  vector<ll> arr(n);
  for (int i = 0; i < (int)(n); i++) cin >> arr[i];
  int m = n;
  sum = sumXOR(arr, m);
  cout << sum % M << endl;
  return 0;
}
