#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long a[n];
  long long bit[65] = {0};
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long nex = 2;
    for (long long j = 0; j < 62; j++) {
      if (a[i] % nex) {
        a[i] -= a[i] % nex;
        bit[j]++;
      }
      nex *= 2;
      if (a[i] == 0) break;
    }
  }
  long long nex = 1;
  for (long long i = 0; i < 65; i++) {
    long long num = (bit[i] * (n - bit[i])) % 1000000007;
    ans += (num * nex) % 1000000007;
    ans %= 1000000007;
    nex *= 2;
  }
  cout << ans << "\n";
  return 0;
}
