#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  vector<int> bit(65, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int c = 0;
    while (a[i]) {
      bit[c] += (a[i] & 1);
      c++;
      a[i] = (a[i] >> 1);
    }
  }
  long long k = 1;
  long long ans = 0;
  for (int i = 0; i < 65; i++) {
    ans += (bit[i] * (n - bit[i])) * k;
    ans %= 1000000007;
    k *= 2;
    k %= 1000000007;
  }
  cout << ans << endl;
}
