#include <bits/stdc++.h>
using namespace std;
using Edge = pair<long long, long long>;
using Graph = vector<vector<Edge>>;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  long long N, CNT[61], ans = 0, pow = 1;
  cin >> N;
  for (int i = (0); i < (61); ++i) CNT[i] = 0;
  for (int i = (0); i < (N); ++i) {
    long long A, it = 0;
    cin >> A;
    while (A > 0) {
      CNT[it] += A % 2;
      A /= 2;
      it++;
    }
  }
  for (int i = (0); i < (61); ++i) {
    ans += (N - CNT[i]) * CNT[i] * pow % 1000000007;
    ans %= 1000000007;
    pow *= 2;
    pow %= 1000000007;
  }
  cout << ans << '\n';
  return 0;
}
