#include <bits/stdc++.h>
using namespace std;
string ConvertBinaryString(int64_t num, size_t size) {
  string str = "";
  while (num != 0) {
    if (num % 2) {
      str += '1';
    } else {
      str += '0';
    }
    num /= 2;
  }
  for (size_t i = str.size(); i < size; ++i) {
    str += '0';
  }
  return str;
}
int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> nums(N);
  size_t max_size = 0;
  for (size_t n = 0; n < N; ++n) {
    cin >> nums[n];
    max_size = max(max_size, static_cast<size_t>(log2(nums[n])) + 1);
  }
  vector<int64_t> zeros(60);
  vector<int64_t> ones(60);
  vector<string> strs;
  for (int64_t n : nums) {
    string bin_str = ConvertBinaryString(n, max_size);
    size_t size = bin_str.size();
    for (size_t i = 0; i < size; ++i) {
      if (bin_str[i] == '1') {
        ++ones[i];
      } else {
        ++zeros[i];
      }
    }
    strs.push_back(bin_str);
  }
  int64_t sum = 0;
  for (string str : strs) {
    size_t size = str.size();
    for (int i = 0; i < size; ++i) {
      if (str[i] == '0') {
        sum += pow(2, i) * ones[i];
        --zeros[i];
      } else {
        sum += (pow(2, i) * zeros[i]);
        --ones[i];
      }
      sum %= 1000000007;
    }
  }
  cout << sum << std::endl;
  return 0;
}
