#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932;
const double EPS = 1e-15;
const int mod = 1e+9 + 7;
const int INF = 1e+9;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long res = 0;
  for (int d = 0; d < 61; ++d) {
    long long one_cnt = 0, zero_cnt = 0;
    for (int i = 0; i < n; ++i) {
      if ((a[i] >> d) & 1)
        ++one_cnt;
      else
        ++zero_cnt;
    }
    long long tmp = (long long)(1 << d) % mod;
    long long cnt = one_cnt * zero_cnt % mod;
    tmp = tmp * cnt % mod;
    res = (res + tmp) % mod;
  }
  cout << res << endl;
}
