#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long pow(long long i, long long exp) {
  if (exp == 0) return 1;
  return i * pow(i, exp - 1) % mod;
}
int main() {
  long long n;
  cin >> n;
  long long answer = 0;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    v.push_back(temp);
  }
  for (long long i = 0; i < 64; i++) {
    vector<long long> bits;
    long long ones = 0;
    for (long long z = 0; z < v.size(); z++) {
      bits.push_back(v[z] % 2);
      ones += v[z] % 2;
      v[z] /= 2;
    }
    answer += pow(2, i) * ones * (n - ones);
    answer %= mod;
  }
  cout << answer;
  return 0;
}
