#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<long long> a = vector<long long>(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<long long> d1 = vector<long long>(60, 0);
  for (int x = 0; x < (int)(60); x++) {
    for (int i = 0; i < (int)(n); i++) {
      if ((a[i] >> x) & 1) {
        d1[x]++;
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    long long c1 = d1[i];
    long long c0 = n - c1;
    long long pair<int, int> = (long long)pow(2, i) % 1000000007;
    ans += pair<int, int> * c1 * c0;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
