#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> cnt(100, 0);
  for (int i = 0; i < (int)(n); i++) {
    unsigned long long a;
    cin >> a;
    for (int j = 0; j < (int)(80); j++) {
      if (a % 2) cnt[j]++;
      a /= 2;
    }
  }
  unsigned long long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    unsigned long long x = cnt[i];
    unsigned long long y = n - cnt[i];
    ans = (ans + (((1LL << i) * x % MOD) * y) % MOD) % MOD;
  }
  cout << ans << endl;
}
