#include <bits/stdc++.h>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int64_t> nums(N);
  for (int n = 0; n < N; ++n) {
    cin >> nums[n];
  }
  sort(nums.begin(), nums.end());
  size_t size = log2(nums.back());
  vector<int64_t> res(size + 1);
  vector<vector<int64_t>> cnt(2, vector<int64_t>(size + 1));
  for (int64_t n : nums) {
    bitset<61> bs(n);
    for (size_t i = 0; i <= size; ++i) {
      if (bs.test(i)) {
        res[i] += cnt[0][i];
        ++cnt[1][i];
      } else {
        res[i] += cnt[1][i];
        ++cnt[0][i];
      }
    }
  }
  int64_t result = 0;
  for (size_t i = 0; i <= size; ++i) {
    result +=
        (static_cast<int64_t>(pow(2, i)) % MOD) * (cnt[0][i] * cnt[1][i] % MOD);
    result %= MOD;
  }
  cout << result << endl;
  return 0;
}
