#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k, ans = 0, b, cur, res, mod = 1000000007;
  cin >> n;
  vector<long long> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  b = 1;
  for (i = 0; i < 60; i++) {
    cur = 0;
    for (j = 0; j < n; j++) {
      cur += a[j] % 2;
      a[j] /= 2;
    }
    ans += b * cur * (n - cur);
    ans %= mod;
    b *= 2;
  }
  cout << ans;
}
