#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long b = 0; b < 60; b++) {
    long long msk = 1ll << b;
    long long zero = 0, one = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] & msk)
        one++;
      else
        zero++;
    }
    ans += (msk % (long long)(1e9 + 7)) * zero * one;
    ans %= (long long)1e9 + 7;
  }
  cout << ans << endl;
  return 0;
}
