#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int, int>;
const int INF = 1001001;
const int NMAX = 8;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  int a[n];
  vector<int> c0(60, 0);
  vector<int> c1(60, 0);
  for (ll i = 0; i < (n); ++i) {
    cin >> a[i];
    for (ll j = 0; j < (60); ++j) {
      if (a[i] & 1 << j)
        c1[j]++;
      else
        c0[j]++;
    }
  }
  int ans = 0;
  int cnt = 1;
  for (ll i = 0; i < (60); ++i) {
    int s = c1[i] * c0[i] % MOD;
    ans += s * cnt;
    ans %= MOD;
    cnt *= 2;
  }
  cout << ans;
}
