#include <bits/stdc++.h>
using namespace std;
class DXorSum4 {
 public:
  void solve(std::istream& in, std::ostream& out) {
    long long int mo = 1e+9 + 7;
    int n;
    in >> n;
    vector<long long int> a(n);
    for (long long int i = 0; i < (n); ++i) {
      in >> a[i];
    }
    vector<int> b(60, 0);
    for (long long int i = 0; i < (n); ++i) {
      for (long long int j = 0; j < (60); ++j) {
        if (a[i] >> j & 1) {
          b[j]++;
        }
      }
    }
    long long int ans = 0;
    for (long long int i = 0; i < (60); ++i) {
      long long int t = (b[i] * (n - b[i])) % mo;
      t *= binpow(2, i, mo);
      t %= mo;
      ans += t;
      ans %= mo;
    }
    out << ans << endl;
  }
  long long int binpow(long long int a, long long int b, long long int mod) {
    long long int ret = 1;
    while (b > 0) {
      if (b & 1) {
        ret = ret * a % mod;
      }
      a = a * a % mod;
      b = b >> 1;
    }
    return ret;
  }
};
int main() {
  DXorSum4 solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
