#include <bits/stdc++.h>
const int INF = 1e9 + 7;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long res = 0;
  vector<pair<long long, long long>> bit(61);
  for (long long i = 0; i < 61; i++) {
    long long x, y;
    x = y = 0;
    for (long long j = 0; j < n; j++) {
      if ((1LL << i) & a[j])
        x++;
      else
        y++;
    }
    res += ((x * y) % INF * (1LL << i) % INF) % INF;
    res %= INF;
  }
  cout << res << endl;
  return 0;
}
