#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
const long long MOD = 1e9 + 7;
const long long N = 1e3 + 10;
const long long INF = 1e18 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<vector<bool>> v(n, vector<bool>(61));
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    for (long long j = 0; j < 61; j++) {
      if (x & (1LL << j)) {
        v[i][j] = 1;
      }
    }
  }
  vector<int> cnt(61);
  for (int i = 0; i < 61; i++) {
    int ones = 0;
    for (int j = 0; j < n; j++) {
      if (v[j][i]) ones++;
    }
    cnt[i] = ones;
  }
  long long sum = 0;
  for (long long i = 0; i < 61; i++) {
    int ones = cnt[i];
    int zeroz = n - cnt[i];
    sum += ones * zeroz * (1LL << i);
    sum %= MOD;
  }
  cout << sum << endl;
  return 0;
}
