#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e+9 + 7;
int main(void) {
  int n;
  cin >> n;
  int s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  long long res = 0;
  for (int i = 0; i < 63; i++) {
    long long y = 0;
    for (int j = 0; j < n; j++) {
      if (s[j] % 2) y++;
      s[j] /= 2;
    }
    long long x = y * (n - y);
    x %= mod;
    x *= ((long long)1 << i) % mod;
    x %= mod;
    res += x;
    res %= mod;
  }
  cout << res << endl;
}
