#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  for (auto&& a : v) out << a << " ";
  out << endl;
  return out;
}
template <class T>
void dump(T& a) {
  cout << a << endl;
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct mint {
  long long x;
  mint() : x(0) {}
  mint(long long x) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint& fix() {
    x = (x % 1000000007 + 1000000007) % 1000000007;
    return *this;
  }
  mint operator-() const { return mint(0) - *this; }
  mint& operator+=(const mint& a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator-=(const mint& a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator*=(const mint& a) {
    (x *= a.x) %= 1000000007;
    return *this;
  }
  mint operator+(const mint& a) const { return mint(*this) += a; }
  mint operator-(const mint& a) const { return mint(*this) -= a; }
  mint operator*(const mint& a) const { return mint(*this) *= a; }
  bool operator<(const mint& a) const { return x < a.x; }
  bool operator==(const mint& a) const { return x == a.x; }
};
ostream& operator<<(ostream& out, mint const& v) {
  out << v.x;
  return out;
}
int nth(long long a, int n) { return (a >> n) & 1; }
int N;
vector<long long> A;
void solve() {
  cin >> N;
  A.resize(N);
  for (int n = 0; n < N; n++) cin >> A[n];
  mint total = 0;
  for (int d = 0; d <= 60; d++) {
    long long D = 1LL << d;
    int num1 = 0;
    for (auto&& a : A) num1 += nth(a, d);
    int num0 = N - num1;
    total += D * num1 * num0;
  }
  cout << total << endl;
}
int main() {
  solve();
  return 0;
}
