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