#include <bits/stdc++.h>
using namespace std;
long long n, x, res;
int c[20];
long long mod = 1000000007;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 0; j < 20; j++) {
      if (x & (1 << j)) c[j]++;
    }
  }
  for (int i = 0; i < 20; i++) res += (long long)(n - c[i]) * c[i] * (1 << i);
  res = res % mod;
  cout << res << endl;
  return 0;
}
