#include <bits/stdc++.h>
using namespace std;
long long int cnt[66][2];
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 0; i < ((long long int)(n)); i++) {
    long long int a;
    cin >> a;
    for (long long int j = 0; j < ((long long int)(60)); j++) {
      cnt[j][(a >> j) & 1]++;
    }
  }
  long long int res = 0;
  for (long long int i = 0; i < ((long long int)(60)); i++) {
    res = (res + (cnt[i][0] * cnt[i][1] % 1000000007) *
                     (1ll << (long long int)(i)) % 1000000007) %
          1000000007;
  }
  cout << res << endl;
  return 0;
}
