#include <bits/stdc++.h>
using namespace std;
const double clf = 1e-8;
const int MMAX = 0x7fffffff;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int dir[4][2] = {-1, 0, 1, 0, 0, -1, 0, 1};
ostream &operator<<(ostream &out, pair<int, int> &p) {
  return out << p.first << " " << p.second;
}
istream &operator>>(istream &in, pair<int, int> &p) {
  return in >> p.first >> p.second;
}
long long a[100010];
int cnt[70];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < 62; j++) {
      cnt[j] += (a[i] & (1LL << j)) ? 1 : 0;
    }
  }
  long long res = 0;
  for (int i = 0; i < 62; i++) {
    res = (res + (((cnt[i] % mod * ((n - cnt[i]) % mod)) % mod) *
                  ((1LL << i) % mod)) %
                     mod) %
          mod;
  }
  cout << res % mod << endl;
  return 0;
}
