#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
const double PI = 3.14159265358979323846;
const int NMAX = 100005;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long digits = 1;
  for (int i = 0; i < 60; i++) {
    long long zero = 0, one = 0;
    for (int j = 0; j < n; j++) {
      int x = (a[j] >> i) & 1;
      if (x == 0)
        zero++;
      else
        one++;
    }
    long long cnt = zero * one;
    cnt *= digits;
    cnt %= MOD;
    ans += cnt;
    ans %= MOD;
    digits = digits * 2L % MOD;
  }
  cout << ans << endl;
  return 0;
}
