#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
const int MOD = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long total = 0;
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < 64; i++) {
    long long oc = 0, zc = 0;
    for (long long j = 0; j < n; j++) {
      if (v[j] & 1)
        oc++;
      else
        zc++;
      v[j] >>= 1;
    }
    total += ((oc * zc) % MOD * 1 << i) % MOD;
    total %= MOD;
  }
  total %= MOD;
  cout << total << endl;
  return 0;
}
