#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n;
long long a[300001];
int main() {
  cin >> n;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  int c1, c2;
  long long ans = 0;
  for (int i = (0); i < (60); ++i) {
    c1 = 0, c2 = 0;
    for (int j = (0); j < (n); ++j) {
      if (a[j] >> i & 1)
        ++c1;
      else
        ++c2;
    }
    ans += (long long)(1ll << i) % mod * c1 * c2;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
