#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> cnt(60, vector<int>(2, 0));
  for (int i = 0; i < (n); ++i) {
    ll a;
    cin >> a;
    for (int j = 0; j < (60); ++j) {
      if (1 & (a >> j))
        cnt[j][1]++;
      else
        cnt[j][0]++;
    }
  }
  ll ans = 0;
  ll mod = 1000000007;
  ll pow = 1;
  for (int i = 0; i < (60); ++i) {
    ans += pow * cnt[i][0] * cnt[i][1] % mod;
    ans %= mod;
    pow = pow * 2 % mod;
  }
  cout << ans << endl;
}
