#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<vector<int>> data(N, vector<int>(60));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (A[i] % 2 == 1) data[i][j] = 1;
      A[i] /= 2;
    }
  }
  vector<long long> data1(60);
  for (int i = 0; i < 60; i++) {
    for (int j = 0; j < N; j++) {
      if (data[j][i] == 1) data1[i]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long x = data1[i] % 1000000007;
    long long y = (N - data1[i]) % 1000000007;
    long long z = pow(2, i);
    z %= 1000000007;
    long long p = (x * y) % 1000000007;
    ans += (p * z) % 1000000007;
  }
  cout << ans << endl;
}
