#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 21;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  sort(a.begin(), a.end());
  long long maxx = a[n - 1];
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    int x = 0;
    int y = 0;
    for (int j = 0; j < (n); ++j) {
      if (a[j] & (1LL << i)) {
        x++;
      } else {
        y++;
      }
    }
    if (x == 0 or y == 0) continue;
    ans += ((long long)pow(2LL, i) * (x * y)) % mod;
  }
  cout << ans % mod << endl;
  return 0;
}
