#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (auto &i : A) cin >> i;
  long long ans = 0;
  for (int k = 0; k < 60; k++) {
    long long t = (1LL << k);
    int x = 0, y = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] & t) == t)
        x++;
      else
        y++;
    }
    t *= x;
    t %= MOD;
    t *= y;
    t %= MOD;
    ans += t;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
