#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long ans = 0;
  vector<long long> v(n);
  long long MOD = 1e9 + 7;
  for (long long i = 0; i < (long long)n; i++) cin >> v[i];
  for (long long j = 0; j < (long long)60; j++) {
    long long one = 0;
    long long zero = 0;
    long long t = ((long long)1 << j);
    for (long long i = 0; i < (long long)n; i++) {
      if ((v[i] & t) != 0)
        one++;
      else
        zero++;
    }
    ans = (ans + ((one * zero) * (t % MOD)) % MOD) % MOD;
  }
  cout << ans << endl;
}
