#include <bits/stdc++.h>
using namespace std;
inline int ceil(int a, int b) { return (a + b - 1) / b; }
const int inf = 10e7;
int main() {
  unsigned long long mod = 1e9 + 7;
  int n;
  cin >> n;
  vector<unsigned long long> v(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> v.at(i);
  }
  unsigned long long ans = 0ull;
  for (int(i) = 0; (i) < (60); (i)++) {
    unsigned long long s = 0ull;
    for (unsigned long long f : v) {
      s += (f >> i) & 1;
    }
    ans += ((s * (n - s) << i) % mod);
    ans %= mod;
  }
  std::cout << (ans) << '\n';
}
