#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
const long long mo = 1000000007;
int main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> v[i];
  }
  for (long long j = 0; j < (long long)(60); j++) {
    long long a = 0, b = 0;
    for (long long i = 0; i < (long long)(n); i++) {
      if (((v[i]) >> j) & 1LL)
        a++;
      else
        b++;
    }
    long long c = a * b;
    c %= mo;
    ans += c * (1LL << j);
    ans %= mo;
  }
  cout << ans << endl;
  return 0;
}
