#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
struct edge {
  long long to, cost, val;
};
template <class T, class U>
bool chmin(T& a, const U& b) {
  if (a <= b) return false;
  a = b;
  return true;
}
template <class T, class U>
bool chmax(T& a, const U& b) {
  if (a >= b) return false;
  a = b;
  return true;
}
long long A[310000];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  long long t = 1, ans = 0;
  int count0 = 0, count1 = 0;
  for (int i = 0; i < 61; i++, t *= 2) {
    count1 = 0;
    count0 = 0;
    for (int j = 1; j <= N; j++) {
      if (A[j] >> i & 1)
        count1++;
      else
        count0++;
    }
    long long x = count0 * count1 * t;
    x %= 1000000007;
    ans += x;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
