#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(60, 0));
  for (int i = 0; i < n; i++) {
    long long A;
    cin >> A;
    for (int j = 0; j < 60; j++) {
      if ((A >> j) & 1) a.at(i).at(j) = 1;
    }
  }
  vector<int> out(60);
  for (int i = 0; i < 60; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      if (a.at(j).at(i) == 1) sum++;
    }
    out.at(i) = sum;
  }
  vector<long long> out2(60);
  for (int i = 0; i < 60; i++) {
    out2.at(i) = out.at(i) * (n - out.at(i));
  }
  long long res = 0;
  long long two = 1;
  for (int i = 0; i < 60; i++) {
    res += (out2.at(i) * (two % 1000000007)) % 1000000007;
    two *= 2;
    two = two % 1000000007;
  }
  cout << res % 1000000007;
}
