#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long power(long long x, unsigned long long y, unsigned long long m) {
  if (y == 0) return 1;
  long long p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
signed main() {
  ios_base::sync_with_stdio(0);
  long long TESTS = 1;
  while (TESTS--) {
    long long n;
    cin >> n;
    long long m[60];
    for (long long i = 0; i < 60; i++) m[i] = 0;
    for (long long i = 0; i < n; i++) {
      long long t;
      cin >> t;
      while (t) {
        long long largest = 0;
        while (power(2, largest, (long long)8 * 1e18) <= t) {
          largest++;
        }
        largest--;
        m[largest]++;
        t -= power(2, largest, (long long)8 * 1e18);
      }
    }
    long long ans = 0;
    for (long long i = 0; i < 60; i++) {
      ans = (ans + (((power(2, i, (long long)8 * 1e18) * m[i]) % 1000000007) *
                    (n - m[i])) %
                       1000000007) %
            1000000007;
    }
    cout << (ans) % 1000000007;
  }
}
