#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000")
#pragma warning(disable : 6031)
#pragma warning(disable : 4244)
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long mod = int(1e9) + 7;
const double eps9 = 1e-9;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << setprecision(18) << fixed;
  int n;
  cin >> n;
  vector<long long> a(n);
  for (long long& i : a) cin >> i;
  vector<long long> res(63);
  for (int bit = 0; bit < 62; bit++) {
    long long zc = 0, oc = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1LL << bit))
        oc++;
      else
        zc++;
    }
    res[bit] = zc * oc;
  }
  long long final_res = 0;
  long long mult = 1;
  for (int bit = 0; bit < 62; bit++, mult *= 2) {
    final_res = (final_res + (res[bit] % mod * mult % mod) % mod) % mod;
  }
  cout << final_res;
  return 0;
}
