#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
long long int sumXOR(vector<long long int> arr, long long int n) {
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (arr[j] & (1LL << i))
        oc++;
      else
        zc++;
    }
    idsum = (oc * zc) % MOD;
    long long int p = (1LL << i) % MOD;
    sum = (sum + idsum * p) % MOD;
  }
  return sum % MOD;
}
int main() {
  long long int sum = 0;
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sum = sumXOR(a, n);
  cout << sum;
  return 0;
}
