#include <bits/stdc++.h>
using namespace std;
string FILENAME = "template";
int main() {
  int N;
  cin >> N;
  vector<long long> nums(N);
  vector<int> onecount(62);
  vector<int> zerocount(62);
  for (int i = 0; i < N; i++) cin >> nums[i];
  for (auto &num : nums) {
    for (int i = 0; i < 62; i++) {
      long long test = pow(2, i);
      if (num & test)
        onecount[i]++;
      else
        zerocount[i]++;
    }
  }
  long long res = 0;
  for (int i = 0; i < 62; i++) {
    long long test = pow(2, i);
    res += (test * onecount[i] * zerocount[i]) % 1000000007;
  }
  cout << res % 1000000007 << endl;
}
