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