#include <bits/stdc++.h>
using namespace std;
uint64_t sovle() {
  int n;
  cin >> n;
  vector<uint64_t> dp(62, 0);
  long long res = 0;
  vector<uint64_t> t(n, 0);
  for (int i = 0; i < n; i++) {
    uint64_t x;
    cin >> x;
    t[i] = x;
    int j = 0;
    while (x) {
      dp[j++] += x % 2;
      x /= 2;
    }
  }
  const uint64_t MOD = 1e9 + 7;
  for (int i = 0; i < 62; i++) {
    uint64_t cnt = dp[i];
    cnt = cnt * (n - cnt);
    res = (res + cnt * (((uint64_t)1 << i) % MOD)) % MOD;
  }
  return (res) % MOD;
}
int main() {
  int T = 1;
  while (T--) {
    uint64_t re = sovle();
    cout << re << endl;
  }
  return 0;
}
