#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 max_v = *max_element(a.begin(), a.end());
  long long num = 0;
  for (long long i = 0; (1LL << i) < max_v; i++) {
    num++;
  }
  long long res = 0;
  vector<pair<int, int>> bit(num);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < num; j++) {
      if ((1LL << j) & a[i])
        bit[j].first++;
      else
        bit[j].second++;
    }
  }
  for (long long i = 0; i < num; i++) {
    res += ((bit[i].first * bit[i].second) * (1LL << i)) % INF;
  }
  res %= INF;
  cout << res << endl;
  return 0;
}
